Evas GL: Fix leak of surfaces with GLES 1.1
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 25 Feb 2015 05:58:19 +0000 (14:58 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 25 Feb 2015 06:01:45 +0000 (15:01 +0900)
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

src/modules/evas/engines/gl_common/evas_gl_core.c

index d79e38f..757f4ba 100644 (file)
@@ -1648,6 +1648,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;
           }
@@ -1710,6 +1711,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:
@@ -1902,8 +1905,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;
+          }
      }
 
 
@@ -1968,6 +1974,8 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
    free(sfc);
    sfc = NULL;
 
+   _surface_context_list_print();
+
    return 1;
 
 }
@@ -2279,6 +2287,8 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
         // Update extensions after GLESv1 context is bound
         evgl_api_gles1_ext_get(gles1_funcs);
 
+        _surface_context_list_print();
+
         return 1;
      }