From 0fe3462f88e861ce5d42fb84387612f80b23f530 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=UTF-8 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 (cherry picked from commit 4d9b518ad2a03232bf8162b05c6504d06c47eb91) Nominated-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 77103492a4f..7288266444d 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -520,7 +520,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; } /**