Mesa (main): glx/drisw: Nerf PutImage when loaderPrivate == NULL
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 15 15:26:44 UTC 2021
Module: Mesa
Branch: main
Commit: 34342cce895b4d666c3f6a1cbf3f3b7da859afc2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=34342cce895b4d666c3f6a1cbf3f3b7da859afc2
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Jun 15 21:53:27 2021 -0400
glx/drisw: Nerf PutImage when loaderPrivate == NULL
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 <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11423>
---
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);
}
More information about the mesa-commit
mailing list