diff mbox

glx: Fix use after free in DrawableGone

Message ID 1285246256-2306-1-git-send-email-krh@bitplanet.net (mailing list archive)
State New, archived
Headers show

Commit Message

Kristian Hogsberg Sept. 23, 2010, 12:50 p.m. UTC
None
diff mbox

Patch

diff --git a/glx/glxext.c b/glx/glxext.c
index e203156..0b04c37 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -160,15 +160,13 @@  static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 		    }
 		}
 	    }
-
-	    if (!c->idExists) {
-		__glXFreeContext(c);
-	    }
 	}
 	if (c->drawPriv == glxPriv)
 	    c->drawPriv = NULL;
 	if (c->readPriv == glxPriv)
 	    c->readPriv = NULL;
+	if (!c->idExists && !c->isCurrent)
+	    __glXFreeContext(c);
     }
 
     glxPriv->destroy(glxPriv);