summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-08-27 16:03:03 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-27 16:20:19 -0600
commitc5f0fd95a43db4c69decd0fa54dc9eb2b2525690 (patch)
treeaaf22b837ed9de8024c524314605c8b024d834b7 /src/egl/drivers
parenta341586d030ebe36f972311cd70088537539b475 (diff)
downloadexternal_mesa3d-c5f0fd95a43db4c69decd0fa54dc9eb2b2525690.zip
external_mesa3d-c5f0fd95a43db4c69decd0fa54dc9eb2b2525690.tar.gz
external_mesa3d-c5f0fd95a43db4c69decd0fa54dc9eb2b2525690.tar.bz2
egl: free display ext data in xdri_eglTerminate().
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/xdri/egl_xdri.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
index 3681d98..6a271ff 100644
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ b/src/egl/drivers/xdri/egl_xdri.c
@@ -651,6 +651,35 @@ xdri_eglInitialize(_EGLDriver *drv, EGLDisplay dpy,
}
+/*
+ * Do some clean-up that normally occurs in XCloseDisplay().
+ * We do this here because we're about to unload a dynamic library
+ * that has added some per-display extension data and callbacks.
+ * If we don't do this here we'll crash in XCloseDisplay() because it'll
+ * try to call functions that went away when the driver library was unloaded.
+ */
+static void
+FreeDisplayExt(Display *dpy)
+{
+ _XExtension *ext, *next;
+
+ for (ext = dpy->ext_procs; ext; ext = next) {
+ next = ext->next;
+ if (ext->close_display) {
+ ext->close_display(dpy, &ext->codes);
+ ext->close_display = NULL;
+ }
+ if (ext->name)
+ Xfree(ext->name);
+ Xfree(ext);
+ }
+ dpy->ext_procs = NULL;
+
+ _XFreeExtData (dpy->ext_data);
+ dpy->ext_data = NULL;
+}
+
+
/**
* Called via eglTerminate(), drv->API.Terminate().
*/
@@ -658,11 +687,16 @@ static EGLBoolean
xdri_eglTerminate(_EGLDriver *drv, EGLDisplay dpy)
{
struct xdri_egl_driver *xdri_drv = xdri_egl_driver(drv);
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
_eglLog(_EGL_DEBUG, "XDRI: eglTerminate");
_eglLog(_EGL_DEBUG, "XDRI: Closing %s", xdri_drv->dri_driver_name);
+
+ FreeDisplayExt(disp->Xdpy);
+
#if 0
+ /* this causes a segfault for some reason */
dlclose(xdri_drv->dri_driver_handle);
#endif
xdri_drv->dri_driver_handle = NULL;