st/xlib: Don't destroy screen on XCloseDisplay()
authorGeorge Kyriazis <george.kyriazis@intel.com>
Fri, 4 Mar 2016 19:26:00 +0000 (12:26 -0700)
committerBrian Paul <brianp@vmware.com>
Sat, 5 Mar 2016 01:14:46 +0000 (18:14 -0700)
screen may still be used by other resources that are not yet freed.
To correctly fix this there will be a need to account for resources
differently, but this quick fix is not any worse than the original
code that leaked screens anyway.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/state_trackers/glx/xlib/xm_api.c

index cee4f18295e057d7d6a5fe179e81a5c81bd7e724..5799cce033c61d6cde94f62ebf6187824b8d7228 100644 (file)
@@ -174,9 +174,13 @@ xmesa_close_display(Display *display)
    /* don't forget to clean up mesaDisplay */
    XMesaDisplay xmdpy = &info->mesaDisplay;
 
-   if (xmdpy->screen) {
-      xmdpy->screen->destroy(xmdpy->screen);
-   }
+   /**
+    * XXX: Don't destroy the screens here, since there may still
+    * be some dangling screen pointers that are used after this point
+    * if (xmdpy->screen) {
+    *    xmdpy->screen->destroy(xmdpy->screen);
+    * }
+    */
    free(xmdpy->smapi);
 
    XFree((char *) info);