From 4d9b518ad2a03232bf8162b05c6504d06c47eb91 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Thu, 21 Apr 2016 15:02:53 +0200 Subject: [PATCH] dri2: Check for dummyContext to see if the glx_context is valid MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/glx/dri2_glx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } /** -- 2.30.2