summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/glthread.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index 8f300d46344..8ee7d8dadac 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -173,9 +173,16 @@ _mesa_glthread_destroy(struct gl_context *ctx)
free(glthread);
ctx->GLThread = NULL;
- /* Remove ourselves from the dispatch table. */
- ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
- _glapi_set_dispatch(ctx->CurrentClientDispatch);
+ /* Remove ourselves from the dispatch table except if another ctx/thread
+ * already installed a new dispatch table.
+ *
+ * Typically glxMakeCurrent will bind a new context (install new table) then
+ * old context might be deleted.
+ */
+ if (_glapi_get_dispatch() == ctx->MarshalExec) {
+ ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
+ _glapi_set_dispatch(ctx->CurrentClientDispatch);
+ }
}
void