SHA256
1
0
forked from pool/Mesa
Mesa/u_dri3-Check-for-dummyContext-to-see-if-the-glx_contex.patch
Stefan Dirsch 0c1b9be49a - u_dri3-Check-for-dummyContext-to-see-if-the-glx_contex.patch
* 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.

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=511
2016-04-21 09:49:50 +00:00

41 lines
1.2 KiB
Diff

From 2be941ebf55e9533652634b180fdbdd0c24075ea Mon Sep 17 00:00:00 2001
From: Stefan Dirsch <sndirsch@suse.de>
Date: Thu, 21 Apr 2016 11:26:07 +0200
Subject: [PATCH] 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>
---
src/glx/dri3_glx.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 6054ffc..e7c2ec1 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
--
2.6.2