summaryrefslogtreecommitdiff
path: root/glamor
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2019-07-19 10:53:19 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2019-10-11 12:03:42 +0000
commit7667180fb9dbd606e40c000aefc807371d2fb478 (patch)
treec53d1840aaa3f084a6ad06e3132021b20c07d2a8 /glamor
parent15354fb68f09eecceec5747a58cd16e6ce9236ca (diff)
glamor_egl: check for non NULL pixmap at egl_close_screen
DDX such as Xorg, Xwayland & Xephyr do not destroy the pixmap before they call into CloseScreen. At the same time Xvfb (support for glamor coming with later commit) do. As such the pixmap will be NULL and we'll crash out. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'glamor')
-rw-r--r--glamor/glamor_egl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 1ad16f733..8a9112f76 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -770,8 +770,13 @@ glamor_egl_close_screen(ScreenPtr screen)
screen_pixmap = screen->GetScreenPixmap(screen);
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
- eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
- pixmap_priv->image = NULL;
+ /* For DDX like Xwayland and Xorg, the pixmap is not destroyed so
+ * we should do so here.
+ */
+ if (pixmap_priv) {
+ eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
+ pixmap_priv->image = NULL;
+ }
screen->CloseScreen = glamor_egl->saved_close_screen;
glamor_egl_cleanup(screen);