diff options
author | Henri Verbeet <[email protected]> | 2011-04-07 23:48:28 +0200 |
---|---|---|
committer | Henri Verbeet <[email protected]> | 2011-04-10 18:53:34 +0200 |
commit | a26121f37530619610a78a5fbe5ef87e44047fda (patch) | |
tree | 314f2fc8a6bd71c00e450bd746b1546e8340fcae /src/glx/glxext.c | |
parent | a75de67c51e9124a7c3846b4110552ea28c60349 (diff) |
glx: Only remove the glx_display from the list after it's destroyed.
Signed-off-by: Henri Verbeet <[email protected]>
Diffstat (limited to 'src/glx/glxext.c')
-rw-r--r-- | src/glx/glxext.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/glx/glxext.c b/src/glx/glxext.c index e35dcb73e89..278c71978fa 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -250,19 +250,24 @@ glx_display_free(struct glx_display *priv) static int __glXCloseDisplay(Display * dpy, XExtCodes * codes) { - struct glx_display *priv, **prev; + struct glx_display *priv, **prev, *next; _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; } |