mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
driDestroyDisplay: Remove Drivers list entry when dlclosing its handle.
This fixes a regression from commit f81b1dbe37:
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.
This commit is contained in:
parent
a2104dc6e1
commit
bed026e7dd
1 changed files with 18 additions and 2 deletions
|
|
@ -386,8 +386,24 @@ static void driDestroyDisplay(Display *dpy, void *private)
|
|||
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue