Weston 12 segfaults when running "x11perf -reps 1 -repeat 1 -all" under XWayland
Running "x11perf -reps 1 -repeat 1 -all" with XWayland and Weston 12.0.1 or 12.0.2 quickly results in a segfault in Weston, although the tests continue to run until completion, as the XWayland server remains active, despite the crash. The exact segfault varies from run to run, but I've attached one example, from Weston 12.0.2 (gdb.txt). I ran Weston 12.0.2 under valgrind, and have attached an edited log, showing a large number of invalid reads and writes (valgrind.out.txt).
The problem appears to be due to commit 87881e2c ("xwm: Add support for xwayland_shell_v1"). Reverting that change for Weston 12.0.1 stopped the segfaults (I didn't retry the workaround for Weston 12.0.2). I've also attached a workaround that stops the segfaults with the commit in place (0001-xwayland-fix-segfault-when-running-X11-perf.patch). As I haven't taken the time to understand the xwayland/window-manager.c code fully, I realise the workaround may not be a proper fix.
gdb.txt valgrind.out.txt 0001-xwayland-fix-segfault-when-running-X11-perf.patch