_X_HIDDEN void
driReleaseDrawables(struct glx_context *gc)
{
- struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
+ const struct glx_display *priv = gc->psc->display;
__GLXDRIdrawable *pdraw;
if (priv == NULL)
static int
__glXCloseDisplay(Display * dpy, XExtCodes * codes)
{
- struct glx_display *priv, **prev, *next;
+ struct glx_display *priv, **prev;
_XLockMutex(_Xglobal_lock);
prev = &glx_displays;
for (priv = glx_displays; priv; prev = &priv->next, priv = priv->next) {
if (priv->dpy == dpy) {
+ *prev = priv->next;
break;
}
}
+ _XUnlockMutex(_Xglobal_lock);
- /* Only remove the display from the list after it's destroyed. The cleanup
- * code (e.g. driReleaseDrawables()) ends up calling __glXInitialize(),
- * which would create a new glx_display while we're trying to destroy this
- * one. */
- next = priv->next;
glx_display_free(priv);
- *prev = next;
- _XUnlockMutex(_Xglobal_lock);
return 1;
}