[PATCH 1/3] Revert "glx: Simplify glXDestroyContext"

Jon TURNEY jon.turney at dronecode.org.uk
Fri Apr 18 04:17:04 PDT 2014


This reverts commit 7f5adf73a0f9a951a6df201532b4031d38054369.

This seems to miss the whole point of the idExists flag, as it makes the
lifetime of that being true the same as the lifetime of the Context resource.

The previously current context tag is always given in a MakeContextCurrent
request, even if that context tag is no longer valid (for example, the context
has been deleted), so this leads to BadContextTag errors.

See fd.o bug #30089 for the makecurrenttest.c testcase, and some discussion of
previous manifestations of this bug.

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 glx/glxcmds.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 187e426..f447e06 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -402,7 +402,9 @@ __glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc)
                          &glxc, &err))
         return err;
 
-    FreeResourceByType(req->context, __glXContextRes, FALSE);
+    glxc->idExists = GL_FALSE;
+    if (!glxc->currentClient)
+        FreeResourceByType(req->context, __glXContextRes, FALSE);
 
     return Success;
 }
-- 
1.8.5.5



More information about the xorg-devel mailing list