From c76d495612be760116eb9ce372f623f3779e6342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 24 Dec 2024 16:01:48 +0100 Subject: [PATCH] Revert "xwayland: Call register_damage depending on ensure_surface_for_window" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There've been reports downstream of Xwayland segfaulting in the function xwl_present_execute() because xwl_window_get_damage_region() returned an invalid pointer: #10 RegionUninit at ../include/regionstr.h:165 #11 RegionEmpty at ../include/regionstr.h:194 #12 xwl_present_execute at ../hw/xwayland/xwayland-present.c:1138 #13 xwl_present_pixmap at ../hw/xwayland/xwayland-present.c:1274 #14 present_pixmap at ../present/present.c:249 #15 proc_present_pixmap_common at ../present/present_request.c:166 #16 proc_present_pixmap at ../present/present_request.c:186 #17 Dispatch at ../dix/dispatch.c:550 #18 dix_main at ../dix/main.c:277 The most likely reason for this is that window_get_damage() returned NULL, which might happen if xwl_window_update_surface_window() didn't call register_damage(). To avoid that issue, move the call to register_damage() back to xwl_realize_window before calling ensure_surface_for_window(). This reverts commit 07f603262700bfe2abcc28f6d7a8e38457d211cc. See-also: https://bugzilla.redhat.com/2329815 See-also: https://bugzilla.redhat.com/2428249 Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1862 Signed-off-by: Michel Dänzer Part-of: --- hw/xwayland/xwayland-window.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index e968e13ea..b0e0cddd9 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -1627,14 +1627,18 @@ xwl_realize_window(WindowPtr window) } } + if (xwl_screen->rootless ? + (window->drawable.class == InputOutput && + window->parent == window->drawable.pScreen->root) : + !window->parent) { + if (!register_damage(window)) + return FALSE; + } + xwl_window = ensure_surface_for_window(window); if (!xwl_window) return FALSE; - if (window == xwl_window->surface_window && - !window_get_damage(window)) - return register_damage(window); - return TRUE; }