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 <Brendan.King@imgtec.com>
This commit is contained in:
Brendan King 2023-07-24 22:50:08 +01:00 committed by Marius Vlad
parent f7d8095352
commit 751c1c9496
1 changed files with 2 additions and 2 deletions

View File

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