[Mesa-dev] [PATCH] dri2: Check for dummyContext to see if the glx_context is valid

Stefan Dirsch sndirsch at suse.de
Wed Apr 20 10:38:54 UTC 2016


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.

Patch author: Egbert Eich <eich at suse.com>

https://bugzilla.opensuse.org/show_bug.cgi?id=962609

Signed-off-by: Egbert Eich <eich at suse.com>
Tested-by: Olaf Hering <ohering at suse.com>
---
 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 7710349..7288266 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;
 }
 
 /**
-- 
2.6.2



More information about the mesa-dev mailing list