summaryrefslogtreecommitdiff
path: root/src/glx/drisw_glx.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2021-06-15 21:53:27 -0400
committerMarge Bot <eric+marge@anholt.net>2021-07-15 15:10:17 +0000
commit34342cce895b4d666c3f6a1cbf3f3b7da859afc2 (patch)
tree55aa069f04d5e12635e7344fd1c5c87a8785ed51 /src/glx/drisw_glx.c
parentf5c8761edab0f3982ab22de774afa81148b47795 (diff)
downloadmesa-34342cce895b4d666c3f6a1cbf3f3b7da859afc2.tar.gz
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@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11423>
Diffstat (limited to 'src/glx/drisw_glx.c')
-rw-r--r--src/glx/drisw_glx.c12
1 files changed, 12 insertions, 0 deletions
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);
}