summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dirsch <sndirsch@suse.de>2016-04-25 15:06:25 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2016-05-05 11:48:31 +0100
commitfb78982721c7451e55b9dcb03d4b709e035ca1db (patch)
tree201ee71d74500a8cd5492daf1cbe823ddd2607da
parentb4d11f93b971a6100f0d5f8ea63b2494d22418e9 (diff)
dri3: 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://lists.freedesktop.org/archives/mesa-dev/2016-April/113962.html Signed-off-by: Stefan Dirsch <sndirsch@suse.de> Reviewed-by: Egbert Eich <eich@freedesktop.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit 7d25ed70362ee9362aeeadb00f5a4e2bea690827)
-rw-r--r--src/glx/dri3_glx.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 6054ffc3dc1..e7c2ec113df 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -127,13 +127,9 @@ static __DRIcontext *
glx_dri3_get_dri_context(struct loader_dri3_drawable *draw)
{
struct glx_context *gc = __glXGetCurrentContext();
+ struct dri3_context *dri3Ctx = (struct dri3_context *) gc;
- if (gc) {
- struct dri3_context *dri3Ctx = (struct dri3_context *) gc;
- return dri3Ctx->driContext;
- }
-
- return NULL;
+ return (gc != &dummyContext) ? dri3Ctx->driContext : NULL;
}
static void