summaryrefslogtreecommitdiffstats
path: root/src/glx/x11/glxcmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11/glxcmds.c')
-rw-r--r--src/glx/x11/glxcmds.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index cd4aede74e4..c63116bab77 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -540,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc)
imported = gc->imported;
gc->xid = None;
+ if (gc->currentDpy) {
+ /* This context is bound to some thread. According to the man page,
+ * we should not actually delete the context until it's unbound.
+ * Note that we set gc->xid = None above. In MakeContextCurrent()
+ * we check for that and delete the context there.
+ */
+ __glXUnlock();
+ return;
+ }
+
#ifdef GLX_DIRECT_RENDERING
/* Destroy the direct rendering context */
if (gc->driContext) {