From b0e4c56dfc3f46eed89682481a1334626d33b845 Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Fri, 30 Jul 2010 21:23:56 +0900 Subject: [PATCH] Fixed segfault problem with GL engine when rotating --- debian/changelog | 8 ++++++++ src/modules/engines/gl_x11/evas_engine.c | 6 ++++++ src/modules/engines/gl_x11/evas_x_main.c | 16 ++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index f7e94a6..5b4679b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +evas (0.9.9.060+svn.49540slp2+3build16) unstable; urgency=low + + * Fixed segfault problem with GL engine when rotating. + * Git: 165.213.180.234:/git/slp/pkgs/evas + * Tag: evas_0.9.9.060+svn.49540slp2+3build16 + + -- Gwanglim Lee Fri, 30 Jul 2010 21:21:34 +0900 + evas (0.9.9.060+svn.49540slp2+3build15) unstable; urgency=low * Fixed word cache & gl bug (from Brett Nash) diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 433db2b..4edaab6 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -325,9 +325,13 @@ eng_setup(Evas *e, void *in) (info->info.destination_alpha != re->win->alpha) || (info->info.rotation != re->win->rot)) { + int inc = 0; + if (re->win) { + re->win->gl_context->references++; eng_window_free(re->win); + inc = 1; gl_wins--; } re->win = eng_window_new(info->info.display, @@ -342,6 +346,8 @@ eng_setup(Evas *e, void *in) info->info.destination_alpha, info->info.rotation); if (re->win) gl_wins++; + if ((re->win) && (inc)) + re->win->gl_context->references--; } else if ((re->win->w != e->output.w) || (re->win->h != e->output.h)) diff --git a/src/modules/engines/gl_x11/evas_x_main.c b/src/modules/engines/gl_x11/evas_x_main.c index ae3e03f..e9dbace 100644 --- a/src/modules/engines/gl_x11/evas_x_main.c +++ b/src/modules/engines/gl_x11/evas_x_main.c @@ -395,14 +395,22 @@ eng_window_new(Display *disp, void eng_window_free(Evas_GL_X11_Window *gw) { + int ref = 0; win_count--; eng_window_use (gw); if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL; - if (gw->gl_context) evas_gl_common_context_free(gw->gl_context); + if (gw->gl_context) + { + ref = gw->gl_context->references - 1; + evas_gl_common_context_free(gw->gl_context); + } #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) if (gw->egl_surface[0] != EGL_NO_SURFACE) - eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); - if (win_count == 0) + { + eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); + gw->egl_surface[0] = EGL_NO_SURFACE; + } + if (ref == 0) { if (context) eglDestroyContext(gw->egl_disp, context); eglTerminate(gw->egl_disp); @@ -411,7 +419,7 @@ eng_window_free(Evas_GL_X11_Window *gw) eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); #else if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin); - if (win_count == 0) + if (ref == 0) { if (context) glXDestroyContext(gw->disp, context); if (rgba_context) glXDestroyContext(gw->disp, rgba_context); -- 2.7.4