summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorGeorge Nassas <[email protected]>2007-12-06 10:11:05 +0100
committerMichel Dänzer <[email protected]>2007-12-06 10:11:05 +0100
commit17afc800c9b69997ae7ba52b67c021f68066e008 (patch)
tree055aeaddd779a023ca818975621fdbe9edfaed16 /src/glx
parent125bd4cae51c6deaacd2e90f14931c2052f146ab (diff)
Always call dlopen in DriverOpen.
This increases the reference count for the driver binary, preventing it from getting unloaded prematurely in driDestroyDisplay. See https://bugs.freedesktop.org/show_bug.cgi?id=13541 .
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/dri_glx.c8
-rw-r--r--src/glx/x11/glxclient.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index c02f105611c..9c3a78b31b7 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -194,7 +194,8 @@ static __DRIdriver *OpenDriver(const char *driverName)
/* First, search Drivers list to see if we've already opened this driver */
for (driver = Drivers; driver; driver = driver->next) {
if (strcmp(driver->name, driverName) == 0) {
- /* found it */
+ /* found it, increment library refcount & return */
+ dlopen(driver->libpath, RTLD_NOW | RTLD_GLOBAL);
return driver;
}
}
@@ -238,7 +239,9 @@ static __DRIdriver *OpenDriver(const char *driverName)
break; /* out of memory! */
/* init the struct */
driver->name = __glXstrdup(driverName);
- if (!driver->name) {
+ driver->libpath = __glXstrdup(realDriverName);
+ if (!driver->name || !driver->libpath) {
+ if (driver->name) XFree(driver->name);
Xfree(driver);
driver = NULL;
break; /* out of memory! */
@@ -401,6 +404,7 @@ static void driDestroyDisplay(Display *dpy, void *private)
Drivers = driver->next;
Xfree(driver->name);
+ Xfree(driver->libpath);
Xfree(driver);
break;
}
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 05354073c45..7054f3cc310 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -117,6 +117,7 @@ struct __DRIdisplayRec {
*/
struct __DRIdriverRec {
const char *name;
+ const char *libpath;
void *handle;
PFNCREATENEWSCREENFUNC createNewScreenFunc;
struct __DRIdriverRec *next;