summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-05-14 11:46:41 +0200
committerKeith Packard <keithp@keithp.com>2009-08-25 20:12:17 -0700
commitfad2de1cca057586a88fb20ebf9a9964f8e3e298 (patch)
tree7eec9a7276612d36034f315bb659c4ac0add6eb7
parenta32d717ac64b21e15a5736ae4981cdd32f2da56b (diff)
glx: If a destroyed window is bound to the current context, make it not current.
Avoids subsequent crashes due to stale pointers to the DrawableRec, see https://bugs.freedesktop.org/show_bug.cgi?id=21132#c15 and previous comments. Signed-off-by: Michel Dänzer <daenzer@vmware.com> (cherry picked from commit 2075d4bf9e53b8baef0b919da6c44771220cd4a5)
-rw-r--r--glx/glxext.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/glx/glxext.c b/glx/glxext.c
index fe99e4e80..c1a1ac9e3 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -127,6 +127,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)