glx: Flush context which is being made non-current due to drawable going away

Some sequences of glean tests fail with GLXBadCurrentWindow when using indirect
rendering, e.g. glean -t 'fpexceptions getString'.

Flush a context which is being made non-current due to the drawable on which is
it is current going away.  Waiting until another context is made current is too
late, as the drawable no longer exists.

v2: Rewrite for direct GL dispatch

v3: Inline FlushContext(), doesn't need to be a separate function

e.g. LIBGL_ALWAYS_INDIRECT=1  ./glean -r results -o --quick -t "fpexceptions
getString" fails with a BadContextTag error.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Jon TURNEY 2014-04-18 12:17:05 +01:00
parent 437b27494f
commit 5c606c0a89

View File

@ -133,6 +133,9 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
next = c->next;
if (c->currentClient &&
(c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
/* flush the context */
glFlush();
c->hasUnflushedCommands = GL_FALSE;
/* just force a re-bind the next time through */
(*c->loseCurrent) (c);
lastGLContext = NULL;