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 2075d4bf9e)
This commit is contained in:
Michel Dänzer 2009-05-14 11:46:41 +02:00 committed by Keith Packard
parent a32d717ac6
commit fad2de1cca

View file

@ -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)