[Mesa-dev] [PATCH v2 2/4] glx/dri3: guard in_current_context against a disappeared drawable

Nicolai Hähnle nhaehnle at gmail.com
Thu Feb 2 17:19:26 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Cc: 17.0 <mesa-stable at lists.freedesktop.org>
---
 src/glx/dri3_glx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index f7bcba3..2d40f0a 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -112,20 +112,24 @@ static void
 glx_dri3_set_drawable_size(struct loader_dri3_drawable *draw,
                            int width, int height)
 {
    /* Nothing to do */
 }
 
 static bool
 glx_dri3_in_current_context(struct loader_dri3_drawable *draw)
 {
    struct dri3_drawable *priv = loader_drawable_to_dri3_drawable(draw);
+
+   if (!priv)
+      return false;
+
    struct dri3_context *pcp = (struct dri3_context *) __glXGetCurrentContext();
    struct dri3_screen *psc = (struct dri3_screen *) priv->base.psc;
 
    return (&pcp->base != &dummyContext) && pcp->base.psc == &psc->base;
 }
 
 static __DRIcontext *
 glx_dri3_get_dri_context(struct loader_dri3_drawable *draw)
 {
    struct glx_context *gc = __glXGetCurrentContext();
-- 
2.9.3



More information about the mesa-dev mailing list