jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=34480d3d5dcce3641ebbd490685ff87fcd93df23

commit 34480d3d5dcce3641ebbd490685ff87fcd93df23
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Wed Apr 29 12:28:08 2015 +0900

    Evas GL: Make current to an Evas GL context before destroying surface 
buffers
    
    Summary:
    We should make current to an Evas GL context before calling 
_surface_buffers_destroy,
    otherwise resources from GL backend will be removed.
    @fix
---
 src/modules/evas/engines/gl_common/evas_gl_core.c | 56 +++++++++++------------
 1 file changed, 26 insertions(+), 30 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 ec32d98..c8cc686 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1933,32 +1933,18 @@ 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 ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
+   // Make current to current context to destroy surface buffers
+   if (!_internal_resource_make_current(eng_data, rsc->current_ctx))
      {
-        if (evgl_engine->api_debug_mode)
-          {
-             ERR("The surface is still current before it's being destroyed.");
-             ERR("Doing make_current(NULL, NULL)");
-          }
-        else
-          {
-             WRN("The surface is still current before it's being destroyed.");
-             WRN("Doing make_current(NULL, NULL)");
-          }
-        evgl_make_current(eng_data, NULL, NULL);
+        ERR("Error doing an internal resource make current");
+        return 0;
      }
 
-   if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
-      sfc->current_ctx->current_sfc = NULL;
-
-   if (!sfc->pbuffer.native_surface)
+   // Destroy created buffers
+   if (!_surface_buffers_destroy(sfc))
      {
-        // Set the context current with resource context/surface
-        if (!_internal_resource_make_current(eng_data, NULL))
-          {
-             ERR("Error doing an internal resource make current");
-             return 0;
-          }
+        ERR("Error deleting surface resources.");
+        return 0;
      }
 
    // Destroy indirect surface
@@ -1983,14 +1969,6 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
           }
      }
 
-
-   // Destroy created buffers
-   if (!_surface_buffers_destroy(sfc))
-     {
-        ERR("Error deleting surface resources.");
-        return 0;
-     }
-
    // Destroy PBuffer surfaces
    if (sfc->pbuffer.native_surface)
      {
@@ -2007,6 +1985,24 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
         return ret;
      }
 
+   if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
+     {
+        if (evgl_engine->api_debug_mode)
+          {
+             ERR("The surface is still current before it's being destroyed.");
+             ERR("Doing make_current(NULL, NULL)");
+          }
+        else
+          {
+             WRN("The surface is still current before it's being destroyed.");
+             WRN("Doing make_current(NULL, NULL)");
+          }
+        evgl_make_current(eng_data, NULL, NULL);
+     }
+
+   if (sfc->current_ctx && sfc->current_ctx->current_sfc == sfc)
+      sfc->current_ctx->current_sfc = NULL;
+
    if (dbg) DBG("Calling make_current(NULL, NULL)");
    if (!evgl_engine->funcs->make_current(eng_data, NULL, NULL, 0))
      {

-- 


Reply via email to