diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2b810b0d863..dcae7f64653 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1502,7 +1502,9 @@ _mesa_make_current( struct gl_context *newCtx, curCtx->Const.ContextReleaseBehavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) { FLUSH_VERTICES(curCtx, 0, 0); - st_glFlush(curCtx, 0); + if (curCtx->st){ + st_glFlush(curCtx, 0); + } } if (!newCtx) { diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6f430edc07e..c61aa17b972 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -371,6 +371,7 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe) if (st->pipe && destroy_pipe) st->pipe->destroy(st->pipe); + st->ctx->st = NULL; FREE(st); }