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: 6779ec5bf6 ("xwayland: Use window pixmap as a window buffer")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1621
This commit is contained in:
Michel Dänzer 2024-01-16 12:17:10 +01:00 committed by Michel Dänzer
parent 2ef0f1116c
commit 3ddb81b15e

View File

@ -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