From 34342cce895b4d666c3f6a1cbf3f3b7da859afc2 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 15 Jun 2021 21:53:27 -0400 Subject: [PATCH] glx/drisw: Nerf PutImage when loaderPrivate == NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This means the drawable was already destroyed. This can happen during diplay teardown, destroying the context will make it current first so it can flush rendering and destroy textures and such, and if the drawable is already destroyed then flushing to nowhere would crash. Reviewed-by: Marek Olšák Part-of: --- src/glx/drisw_glx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 18bbf2b5744..122c35221ab 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -216,6 +216,9 @@ swrastPutImageShm(__DRIdrawable * draw, int op, { struct drisw_drawable *pdp = loaderPrivate; + if (!pdp) + return; + pdp->shminfo.shmaddr = shmaddr; swrastXPutImage(draw, op, 0, 0, x, y, w, h, stride, shmid, shmaddr + offset, loaderPrivate); @@ -230,6 +233,9 @@ swrastPutImageShm2(__DRIdrawable * draw, int op, { struct drisw_drawable *pdp = loaderPrivate; + if (!pdp) + return; + pdp->shminfo.shmaddr = shmaddr; swrastXPutImage(draw, op, x, 0, x, y, w, h, stride, shmid, shmaddr + offset, loaderPrivate); @@ -240,6 +246,9 @@ swrastPutImage2(__DRIdrawable * draw, int op, int x, int y, int w, int h, int stride, char *data, void *loaderPrivate) { + if (!loaderPrivate) + return; + swrastXPutImage(draw, op, 0, 0, x, y, w, h, stride, -1, data, loaderPrivate); } @@ -249,6 +258,9 @@ swrastPutImage(__DRIdrawable * draw, int op, int x, int y, int w, int h, char *data, void *loaderPrivate) { + if (!loaderPrivate) + return; + swrastXPutImage(draw, op, 0, 0, x, y, w, h, 0, -1, data, loaderPrivate); }