From 2d3025e553e6b660e4dddc8f6990f10e2ec7084b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 25 Feb 2015 14:58:19 +0900 Subject: [PATCH] Evas GL: Fix leak of surfaces with GLES 1.1 When destroying a GLES 1.1 surface, it is necessary to also destroy and remove the main surface from the list. This issue probably never really showed up because people don't: - use GLES 1.1 - constantly create & destroy new Evas GL surfaces - but mostly no one cares about 1.1 anymore :) @fix --- .../evas/engines/gl_common/evas_gl_core.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 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 e23777d44e..acc673fc27 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -1607,6 +1607,7 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h) { if (!evgl_engine->funcs->gles1_surface_create) { + ERR("Can't create GLES 1.1 surfaces"); evas_gl_common_error_set(eng_data, EVAS_GL_NOT_INITIALIZED); goto error; } @@ -1669,6 +1670,8 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h) if (dbg) DBG("Created surface sfc %p (eng %p)", sfc, eng_data); + _surface_context_list_print(); + return sfc; error: @@ -1860,8 +1863,11 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc) DBG("Destroying special surface used for GLES 1.x rendering"); ret = evgl_engine->funcs->gles1_surface_destroy(eng_data, sfc); - if (!ret) ERR("Engine failed to destroy a GLES1.x Surface."); - return ret; + if (!ret) + { + ERR("Engine failed to destroy a GLES1.x Surface."); + return ret; + } } @@ -1926,6 +1932,8 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc) free(sfc); sfc = NULL; + _surface_context_list_print(); + return 1; } @@ -2197,6 +2205,12 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) ctx->current_sfc = sfc; rsc->current_ctx = ctx; rsc->current_eng = eng_data; + + // Update extensions after GLESv1 context is bound + //evgl_api_gles1_ext_get(gles1_funcs); + + _surface_context_list_print(); + return 1; }