forked from enlightenment/efl
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.
This commit is contained in:
parent
5e832dfa76
commit
9b6db6b3b5
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue