mesa: Branch 'master' - 2 commits

Michel Daenzer daenzer at kemper.freedesktop.org
Thu Feb 1 09:46:20 UTC 2007


 src/glx/x11/dri_glx.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

New commits:
diff-tree 8628b382e4ac492d829fe720219187b758add003 (from bed026e7dda14ac1c555f1fb16d70eadcd1a01fc)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Thu Feb 1 10:45:51 2007 +0100

    driDestroyDisplay: Fix comment, it is called now.

diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 5ff1a94..6f944d7 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -376,7 +376,7 @@ const char *glXGetDriverConfig (const ch
 }
 
 
-/* This function isn't currently used.
+/* Called from __glXFreeDisplayPrivate.
  */
 static void driDestroyDisplay(Display *dpy, void *private)
 {
diff-tree bed026e7dda14ac1c555f1fb16d70eadcd1a01fc (from a2104dc6e18879ed3ba2108a09b6779e461eaa17)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Thu Feb 1 10:43:10 2007 +0100

    driDestroyDisplay: Remove Drivers list entry when dlclosing its handle.
    
    This fixes a regression from commit f81b1dbe374fe446f6ef676e70a72952ffb47d4e:
    Since then, driDestroyDisplay gets called from __glXFreeDisplayPrivate. It
    dlcloses the handles associated with the display but fails to remove their
    references from the Drivers list, so subsequent calls to OpenDriver return a
    stale handle and an invalid createNewScreenFunc pointer. The attempt to call
    the latter results in a segfault when running amoeba, e.g.

diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 0875361..5ff1a94 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -386,8 +386,24 @@ static void driDestroyDisplay(Display *d
         const int numScreens = ScreenCount(dpy);
         int i;
         for (i = 0; i < numScreens; i++) {
-            if (pdpyp->libraryHandles[i])
-                dlclose(pdpyp->libraryHandles[i]);
+	   if (pdpyp->libraryHandles[i]) {
+	      __DRIdriver *driver, *prev;
+
+	      /* Remove driver from Drivers list */
+	      for (prev = NULL, driver = Drivers; driver;
+		   prev = driver, driver = driver->next) {
+		 if (driver->handle == pdpyp->libraryHandles[i]) {
+		    if (prev)
+		       prev->next = driver->next;
+		    else
+		       Drivers = driver->next;
+
+		    Xfree(driver);
+		 }
+	      }
+
+	      dlclose(pdpyp->libraryHandles[i]);
+	   }
         }
         Xfree(pdpyp->libraryHandles);
 	Xfree(pdpyp);



More information about the mesa-commit mailing list