raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=01cd90b6c3e695fad36378cc5be0149eef0d4ea8

commit 01cd90b6c3e695fad36378cc5be0149eef0d4ea8
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Thu Aug 7 19:34:13 2014 +0900

    evas gl - glx - sety current to NULL on free of window or context
    
    hunting a mem leak i found we dont nuke the current context when
    freeing it or the window bound to the current context. fix this.
---
 src/modules/evas/engines/gl_x11/evas_x_main.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c 
b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 4a0cf62..31e120e 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -447,9 +447,18 @@ eng_window_free(Outbuf *gw)
         context = EGL_NO_CONTEXT;
      }
 #else
-   if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
+   if (gw->glxwin)
+     {
+        glXMakeContextCurrent(gw->disp, 0, 0, gw->context);
+        glXDestroyWindow(gw->disp, gw->glxwin);
+     }
    if (ref == 0)
      {
+        if (!gw->glxwin)
+          {
+             if (glXGetCurrentContext() == gw->context)
+               glXMakeCurrent(gw->disp, 0, NULL);
+          }
         if (context) glXDestroyContext(gw->disp, context);
         if (rgba_context) glXDestroyContext(gw->disp, rgba_context);
         context = 0;
@@ -457,6 +466,11 @@ eng_window_free(Outbuf *gw)
         fbconf = 0;
         rgba_fbconf = 0;
      }
+   else if (!gw->glxwin)
+     {
+        if (glXGetCurrentDrawable() == gw->win)
+          glXMakeCurrent(gw->disp, 0, gw->context);
+     }
 #endif
    free(gw);
 }

-- 


Reply via email to