From 3ddb81b15ef8424482a3ec942bb58230cb3eb0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 16 Jan 2024 12:17:10 +0100 Subject: [PATCH] xwayland: Update screen pixmap for root window in xwl_window_set_pixmap If the old window pixmap was the screen pixmap. Fixes screen->GetScreenPixmap() returning a stale pointer to a destroyed pixmap with rootful Xwayland. It would result in a crash after resizing the Xwayland window, or at the latest when shutting down. Fixes: 6779ec5bf67a ("xwayland: Use window pixmap as a window buffer") Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1621 --- hw/xwayland/xwayland-window-buffers.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index 599ad5370..40e19e349 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -281,6 +281,10 @@ xwl_window_set_pixmap(WindowPtr window, PixmapPtr pixmap) #endif TraverseTree(window, xwl_set_pixmap_visit_window, &visit); + + if (window == screen->root && + screen->GetScreenPixmap(screen) == visit.old) + screen->SetScreenPixmap(pixmap); } static PixmapPtr