summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorGregory Hainaut <[email protected]>2017-02-13 19:14:28 +0100
committerTimothy Arceri <[email protected]>2017-03-16 14:14:19 +1100
commit70e715eea618f31a1b84a99b063c371af3513754 (patch)
tree0c8a3b925317c0ec3c25a4d1e6041f5b7a892eeb /src/mesa/main
parent012bfebc0779bd0eed10ccbdec2edb874992d0dd (diff)
mesa/glthread: don't set a dispatch table if we aren't the owner
Fix crashes when glxMakeCurrent is called. Signed-off-by: Gregory Hainaut <[email protected]> Signed-off-by: Marek Olšák <[email protected]> Acked-by: Timothy Arceri <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Mike Lothian <[email protected]>
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