summaryrefslogtreecommitdiffstats
path: root/src/glx/x11/glxext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11/glxext.c')
-rw-r--r--src/glx/x11/glxext.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 077398fe33f..1d9be297414 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -350,6 +350,8 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv)
#ifdef GLX_DIRECT_RENDERING
if (psc->driScreen)
psc->driScreen->destroyScreen(psc);
+ if (psc->drawHash)
+ __glxHashDestroy(psc->drawHash);
#endif
}
XFree((char*) priv->screenConfigs);
@@ -772,8 +774,15 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
psc->scr = i;
psc->dpy = dpy;
#ifdef GLX_DIRECT_RENDERING
- if (priv->driDisplay)
+ if (priv->driDisplay) {
+ /* Create drawable hash */
+ psc->drawHash = __glxHashCreate();
+ if (psc->drawHash == NULL)
+ continue;
psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
+ if (psc->driScreen == NULL)
+ __glxHashDestroy(psc->drawHash);
+ }
#endif
}
SyncHandle();
@@ -1192,7 +1201,13 @@ FetchDRIDrawable(Display *dpy, GLXDrawable drawable, GLXContext gc)
if (__glxHashLookup(psc->drawHash, drawable, (void *) &pdraw) == 0)
return pdraw;
- return psc->driScreen->createDrawable(psc, drawable, gc);
+ pdraw = psc->driScreen->createDrawable(psc, drawable, gc);
+ if (__glxHashInsert(psc->drawHash, drawable, pdraw)) {
+ (*pdraw->destroyDrawable)(pdraw);
+ return NULL;
+ }
+
+ return pdraw;
}
#endif /* GLX_DIRECT_RENDERING */