summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/x11/fakeglx.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index c060711cac6..37b5e2f2b32 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1532,16 +1532,18 @@ void _kw_ungrab_all( Display *dpy )
static void
Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
{
- struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
- (void) dpy;
- MakeCurrent_PrevContext = 0;
- MakeCurrent_PrevDrawable = 0;
- MakeCurrent_PrevReadable = 0;
- MakeCurrent_PrevDrawBuffer = 0;
- MakeCurrent_PrevReadBuffer = 0;
- XMesaDestroyContext( glxCtx->xmesaContext );
- XMesaGarbageCollect(dpy);
- free(glxCtx);
+ if (ctx) {
+ struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
+ (void) dpy;
+ MakeCurrent_PrevContext = 0;
+ MakeCurrent_PrevDrawable = 0;
+ MakeCurrent_PrevReadable = 0;
+ MakeCurrent_PrevDrawBuffer = 0;
+ MakeCurrent_PrevReadBuffer = 0;
+ XMesaDestroyContext( glxCtx->xmesaContext );
+ XMesaGarbageCollect(dpy);
+ free(glxCtx);
+ }
}