[PATCH] glx: If a destroyed window is bound to the current context, make it not current.

Michel Dänzer michel at daenzer.net
Sat May 9 09:23:12 PDT 2009


From: Michel Dänzer <daenzer at vmware.com>

Avoids subsequent crashes due to stale pointers to the DrawableRec, see
https://bugs.freedesktop.org/show_bug.cgi?id=21132#c15 and previous comments.
---
 glx/glxext.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/glx/glxext.c b/glx/glxext.c
index 93391e9..6bc7bef 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -126,6 +126,10 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
     __GLXcontext *c;
 
     for (c = glxAllContexts; c; c = c->next) {
+	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+	    (*c->loseCurrent)(c);
+	    __glXFlushContextCache();
+	}
 	if (c->drawPriv == glxPriv)
 	    c->drawPriv = NULL;
 	if (c->readPriv == glxPriv)
-- 
1.6.2.4



More information about the xorg-devel mailing list