From: Egbert Eich Date: Thu, 21 Apr 2016 13:02:53 +0000 (+0200) Subject: dri2: Check for dummyContext to see if the glx_context is valid X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d9b518ad2a03232bf8162b05c6504d06c47eb91;p=mesa.git dri2: Check for dummyContext to see if the glx_context is valid According to the comments in src/glx/glxcurrent.c __glXGetCurrentContext() always returns a valid pointer. If no context is made current, it will contain dummyContext. Thus a test for NULL will always fail. https://bugzilla.opensuse.org/show_bug.cgi?id=962609 Tested-by: Olaf Hering Reviewed-by: Michel Dänzer Reviewed-by: Emil Velikov --- diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 5c5630dbb4d..af388d97d31 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -514,7 +514,7 @@ dri2GetCurrentContext() struct glx_context *gc = __glXGetCurrentContext(); struct dri2_context *dri2Ctx = (struct dri2_context *)gc; - return dri2Ctx ? dri2Ctx->driContext : NULL; + return (gc != &dummyContext) ? dri2Ctx->driContext : NULL; } /**