Mesa (master): dri2: Check for dummyContext to see if the glx_context is valid

Emil Velikov evelikov at kemper.freedesktop.org
Wed Apr 27 12:07:18 UTC 2016


Module: Mesa
Branch: master
Commit: 4d9b518ad2a03232bf8162b05c6504d06c47eb91
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d9b518ad2a03232bf8162b05c6504d06c47eb91

Author: Egbert Eich <eich at suse.com>
Date:   Thu Apr 21 15:02:53 2016 +0200

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 <ohering at suse.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.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 5c5630d..af388d9 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;
 }
 
 /**




More information about the mesa-commit mailing list