summaryrefslogtreecommitdiff
path: root/src/modules
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 /src/modules
parent5e832dfa76efba3ecbdc79d55c1444d583ae0d0a (diff)
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.
Diffstat (limited to 'src/modules')
-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 3c79e69..bd597df 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)
1938 if ((dbg = evgl_engine->api_debug_mode)) 1938 if ((dbg = evgl_engine->api_debug_mode))
1939 DBG("Destroying surface sfc %p (eng %p)", sfc, eng_data); 1939 DBG("Destroying surface sfc %p (eng %p)", sfc, eng_data);
1940 1940
1941 if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
1942 sfc->current_ctx->current_sfc = NULL;
1943
1944 if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) ) 1941 if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
1945 { 1942 {
1946 if (evgl_engine->api_debug_mode) 1943 if (evgl_engine->api_debug_mode)
@@ -1956,6 +1953,9 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
1956 evgl_make_current(eng_data, NULL, NULL); 1953 evgl_make_current(eng_data, NULL, NULL);
1957 } 1954 }
1958 1955
1956 if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
1957 sfc->current_ctx->current_sfc = NULL;
1958
1959 if (!sfc->pbuffer.native_surface) 1959 if (!sfc->pbuffer.native_surface)
1960 { 1960 {
1961 // Set the context current with resource context/surface 1961 // Set the context current with resource context/surface
@@ -2123,6 +2123,9 @@ evgl_context_destroy(void *eng_data, EVGL_Context *ctx)
2123 2123
2124 if (dbg) DBG("Destroying context (eng = %p, ctx = %p)", eng_data, ctx); 2124 if (dbg) DBG("Destroying context (eng = %p, ctx = %p)", eng_data, ctx);
2125 2125
2126 if (ctx->current_sfc && (ctx->current_sfc->current_ctx == ctx))
2127 ctx->current_sfc->current_ctx = NULL;
2128
2126 // Set the context current with resource context/surface 2129 // Set the context current with resource context/surface
2127 if (!_internal_resource_make_current(eng_data, NULL)) 2130 if (!_internal_resource_make_current(eng_data, NULL))
2128 { 2131 {