From: Rafael Antognolli Date: Tue, 13 Aug 2013 19:54:53 +0000 (-0300) Subject: evas/wayland_egl: Skip makecurrent if re->win is NULL. X-Git-Tag: submit/tizen/20130814.144019~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eecf2bbdad67ebb19e665a800d238205e67fc48a;p=platform%2Fupstream%2Fevas.git evas/wayland_egl: Skip makecurrent if re->win is NULL. This happens on wayland_egl because we free and set the re->win to NULL on ecore_evas_hide(). It's a workaround since the proper fix would be to not free the re->win on hide, but that will require a lot more changes. --- diff --git a/src/modules/engines/wayland_egl/evas_engine.c b/src/modules/engines/wayland_egl/evas_engine.c index c6be47e..cbe10e4 100644 --- a/src/modules/engines/wayland_egl/evas_engine.c +++ b/src/modules/engines/wayland_egl/evas_engine.c @@ -2649,11 +2649,14 @@ eng_gl_surface_destroy(void *data, void *surface) if ((rsc = eina_tls_get(resource_key)) == EINA_FALSE) return 0; - ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context); - if (!ret) + if (re->win) { - ERR("xxxMakeCurrent() failed!"); - return 0; + ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, rsc->surface, rsc->context); + if (!ret) + { + ERR("xxxMakeCurrent() failed!"); + return 0; + } } // Delete FBO/RBO and Texture here @@ -2666,12 +2669,15 @@ eng_gl_surface_destroy(void *data, void *surface) if (sfc->rb_stencil) glDeleteRenderbuffers(1, &sfc->rb_stencil); - ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (!ret) + if (re->win) { - ERR("xxxMakeCurrent() failed!"); - free(sfc); - return 0; + ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!ret) + { + ERR("xxxMakeCurrent() failed!"); + free(sfc); + return 0; + } } free(sfc); @@ -2747,12 +2753,15 @@ eng_gl_context_destroy(void *data, void *context) if ((rsc = eina_tls_get(resource_key)) == EINA_FALSE) return 0; // 1. Do a make current with the given context - ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, - rsc->surface, ctx->context); - if (!ret) + if (re->win) { - ERR("xxxMakeCurrent() failed!"); - return 0; + ret = eglMakeCurrent(re->win->egl_disp, rsc->surface, + rsc->surface, ctx->context); + if (!ret) + { + ERR("xxxMakeCurrent() failed!"); + return 0; + } } // 2. Delete the FBO @@ -2760,16 +2769,20 @@ eng_gl_context_destroy(void *data, void *context) glDeleteFramebuffers(1, &ctx->context_fbo); // 3. Destroy the Context - eglDestroyContext(re->win->egl_disp, ctx->context); + if (re->win) + eglDestroyContext(re->win->egl_disp, ctx->context); ctx->context = EGL_NO_CONTEXT; - ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (!ret) + if (re->win) { - ERR("xxxMakeCurrent() failed!"); - return 0; + ret = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, + EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!ret) + { + ERR("xxxMakeCurrent() failed!"); + return 0; + } } if (current_evgl_ctx == ctx) @@ -2851,15 +2864,25 @@ eng_gl_make_current(void *data __UNUSED__, void *surface, void *context) eng_window_use(NULL); // Do a make current - ret = eglMakeCurrent(re->win->egl_disp, - re->win->egl_surface[0], - re->win->egl_surface[0], - ctx->context); - - if (!ret) + // FIXME: Skip makecurrent if re->win is NULL. This happens + // on wayland_egl because we free and set the re->win to NULL + // on ecore_evas_hide(). It's a workaround since the proper + // fix would be to not free the re->win on hide, but that + // will require a lot more changes. + if (!re->win) + return ret = 1; + else { - ERR("xxxMakeCurrent() failed!"); - return 0; + ret = eglMakeCurrent(re->win->egl_disp, + re->win->egl_surface[0], + re->win->egl_surface[0], + ctx->context); + + if (!ret) + { + ERR("xxxMakeCurrent() failed!"); + return 0; + } } } }