jpeg pushed a commit to branch master.

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

commit c4189109481b482b72864f438f5f245cfbd790ca
Author: sunghyun kim <[email protected]>
Date:   Tue Nov 17 18:36:31 2015 +0900

    Evas GL: XFreeColormap when window free
    
    When gl window is created, XCreateColormap is called in eng_best_visual_get
    but when gl window is freed, Colormap is not freed.
    
    See original patch: D3342.
---
 src/modules/evas/engines/gl_x11/evas_x_main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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 d00b4ff..031f790 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -27,6 +27,7 @@ struct _Evas_GL_X11_Visual
    XVisualInfo info;
    GLConfig config;
    Colormap cmap;
+   Display *disp;
    Eina_Bool alpha;
 };
 
@@ -125,7 +126,10 @@ __glXMakeContextCurrent(Display *disp, GLXDrawable glxwin, 
GLXContext context)
 static void
 _visuals_hash_del_cb(void *data)
 {
-   free(data);
+   Evas_GL_X11_Visual *evis = data;
+   if (evis && evis->cmap && evis->disp)
+     XFreeColormap(evis->disp, evis->cmap);
+   free(evis);
 }
 
 static inline int
@@ -604,10 +608,10 @@ eng_window_free(Outbuf *gw)
    if (ref == 0)
      {
         if (context) eglDestroyContext(gw->egl_disp, context);
-        eglTerminate(gw->egl_disp);
-        eglReleaseThread();
         eina_hash_free(_evas_gl_visuals);
         _evas_gl_visuals = NULL;
+        eglTerminate(gw->egl_disp);
+        eglReleaseThread();
         _tls_context_set(EGL_NO_CONTEXT);
      }
 #else
@@ -1220,6 +1224,7 @@ try_again:
    if (!evis->cmap)
      {
         /* save colormap now */
+        evis->disp = einfo->info.display;
         evis->cmap = XCreateColormap(einfo->info.display,
                                     RootWindow(einfo->info.display,
                                                einfo->info.screen),

-- 


Reply via email to