1
commit 3020b1d43e34fca08cd51f7c7c8ed51497d49ef3
2
Author: Michel Dänzer <daenzer@vmware.com>
3
Date: Tue Jun 23 16:45:40 2009 +0200
5
glx: Clean up more thoroughly if the drawable of a current context goes away.
7
Fixes crash when restarting compiz, due to cl->currentContexts[x] being stale.
9
diff --git a/glx/glxext.c b/glx/glxext.c
10
index 520eb2e..a571ec9 100644
13
@@ -128,8 +128,31 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
15
for (c = glxAllContexts; c; c = c->next) {
16
if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
20
- __glXFlushContextCache();
21
+ c->isCurrent = GL_FALSE;
22
+ if (c == __glXLastContext)
23
+ __glXFlushContextCache();
25
+ for (i = 1; i < currentMaxClients; i++) {
27
+ __GLXclientState *cl = glxGetClient(clients[i]);
32
+ for (j = 0; j < cl->numCurrentContexts; j++) {
33
+ if (cl->currentContexts[j] == c)
34
+ cl->currentContexts[j] = NULL;
41
+ __glXFreeContext(c);
44
if (c->drawPriv == glxPriv)