From 5c606c0a89e74fa223a99864be11cc3be60a159b Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Fri, 18 Apr 2014 12:17:05 +0100 Subject: [PATCH] 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 Reviewed-by: Adam Jackson --- glx/glxext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glx/glxext.c b/glx/glxext.c index c2de3cedd..978d27112 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -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;