From 751c1c9496357004e00d826e9fc5adc0149fb773 Mon Sep 17 00:00:00 2001 From: Brendan King Date: Mon, 24 Jul 2023 22:50:08 +0100 Subject: [PATCH] xwayland: fix segfault when running x11perf Running "x11perf -reps 1 -repeat 1 -all" will segfault, due to windows being left on lists after being destroyed. The fix was devised after running Weston under valgrind whilst x11perf was running. Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/797 Signed-off-by: Brendan King --- xwayland/window-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index 272f6141..cccae353 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -938,6 +938,7 @@ weston_wm_create_surface(struct wl_listener *listener, void *data) xserver_map_shell_surface(window, surface); window->surface_id = 0; wl_list_remove(&window->link); + wl_list_init(&window->link); break; } } @@ -1658,8 +1659,7 @@ weston_wm_window_destroy(struct weston_wm_window *window) if (window->frame) frame_destroy(window->frame); - if (window->surface_id) - wl_list_remove(&window->link); + wl_list_remove(&window->link); if (window->surface) wl_list_remove(&window->surface_destroy_listener.link);