aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-14 20:55:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-14 21:19:13 +0900
commit9b6db6b3b5005de99448c102258d9ac21944b8e1 (patch)
tree1e3e0340f4f02dcc7ee4f5b904f5edeb7101630e
parentEvas GL: Disable direct rendering if there is a map (diff)
downloadefl-9b6db6b3b5005de99448c102258d9ac21944b8e1.tar.gz
Evas GL: Add some safety code
Set some pointers to NULL to avoid invalid accesses after free. Move the similar condition for sfc after the make_current check.
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 3c79e692f3..bd597df729 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1938,9 +1938,6 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
if ((dbg = evgl_engine->api_debug_mode))
DBG("Destroying surface sfc %p (eng %p)", sfc, eng_data);
- if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
- sfc->current_ctx->current_sfc = NULL;
-
if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
{
if (evgl_engine->api_debug_mode)
@@ -1956,6 +1953,9 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
evgl_make_current(eng_data, NULL, NULL);
}
+ if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
+ sfc->current_ctx->current_sfc = NULL;
+
if (!sfc->pbuffer.native_surface)
{
// Set the context current with resource context/surface
@@ -2123,6 +2123,9 @@ evgl_context_destroy(void *eng_data, EVGL_Context *ctx)
if (dbg) DBG("Destroying context (eng = %p, ctx = %p)", eng_data, ctx);
+ if (ctx->current_sfc && (ctx->current_sfc->current_ctx == ctx))
+ ctx->current_sfc->current_ctx = NULL;
+
// Set the context current with resource context/surface
if (!_internal_resource_make_current(eng_data, NULL))
{