From 3641c24bd012d032ec289cde312a9a5a3ba8c3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 18 May 2021 17:56:50 +0200 Subject: [PATCH] xwayland/eglstream: Handle xwl_pixmap_get returning NULL In xwl_glamor_eglstream_get_wl_buffer_for_pixmap. This can likely be hit now with an SHM pixmap via the Present flip path. There might be other corner cases. Fixes: f3eb1684fa50 "xwayland: enable MIT-SHM shared pixmaps" Reviewed-by: Olivier Fourdan --- hw/xwayland/xwayland-glamor-eglstream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c index 0affc954c..032f8a600 100644 --- a/hw/xwayland/xwayland-glamor-eglstream.c +++ b/hw/xwayland/xwayland-glamor-eglstream.c @@ -334,7 +334,12 @@ xwl_glamor_eglstream_destroy_pixmap(PixmapPtr pixmap) static struct wl_buffer * xwl_glamor_eglstream_get_wl_buffer_for_pixmap(PixmapPtr pixmap) { - return xwl_pixmap_get(pixmap)->buffer; + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + + if (!xwl_pixmap) + return NULL; + + return xwl_pixmap->buffer; } static void