If an xdg_popup isn't destroyed in response to xdg_popup.popup_done, switching focus leads to NULL dereference
(tested with 47d58f7f)
Tested with https://gitlab.freedesktop.org/vyivel/randfall/-/blob/main/cases/xdg_popup_interactive_ignore_popup_done.c
- Open an popup by clicking on the toplevel surface
- Dismiss the popup by clicking anywhere else
- Try to switch focus by clicking on another window or opening a new one
../desktop-shell/shell.c:1565:12: runtime error: member access within null pointer of type 'struct shell_surface'
AddressSanitizer:DEADLYSIGNAL
=================================================================
==55003==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000178 (pc 0x7fbe6dee4034 bp 0x7ffe5c9fe300 sp 0x7ffe5c9fe280 T0)
==55003==The signal is caused by a READ memory access.
==55003==Hint: address points to the zero page.
#0 0x7fbe6dee4034 in has_keyboard_focused_child_callback ../desktop-shell/shell.c:1565
#1 0x7fbe8414c16e in weston_desktop_surface_foreach_child ../libweston/desktop/surface.c:896
#2 0x7fbe6dee4342 in has_keyboard_focused_child ../desktop-shell/shell.c:1583
#3 0x7fbe6dee44b6 in sync_surface_activated_state ../desktop-shell/shell.c:1604
#4 0x7fbe6dee4803 in shell_surface_deactivate ../desktop-shell/shell.c:1634
#5 0x7fbe6defb198 in activate ../desktop-shell/shell.c:3637
#6 0x7fbe6deec6a7 in map ../desktop-shell/shell.c:2277
#7 0x7fbe6deed129 in desktop_surface_committed ../desktop-shell/shell.c:2331
#8 0x7fbe8413ab84 in weston_desktop_api_committed ../libweston/desktop/libweston-desktop.c:159
#9 0x7fbe84156fb8 in weston_desktop_xdg_toplevel_committed ../libweston/desktop/xdg-shell.c:793
#10 0x7fbe8415cfb4 in weston_desktop_xdg_surface_committed ../libweston/desktop/xdg-shell.c:1505
#11 0x7fbe84144471 in weston_desktop_surface_surface_committed ../libweston/desktop/surface.c:193
#12 0x7fbe8403f7ca in wl_signal_emit /usr/include/wayland-server-core.h:496
#13 0x7fbe8407cbd9 in weston_surface_commit_state ../libweston/compositor.c:4536
#14 0x7fbe8407ce75 in weston_surface_commit ../libweston/compositor.c:4551
#15 0x7fbe8407dc1b in surface_commit ../libweston/compositor.c:4636
#16 0x7fbe84505be5 in ffi_call_unix64 (/lib64/libffi.so.8+0x7be5) (BuildId: f5312719df7de0c6ae9d42ed18680d8016bb59d4)
#17 0x7fbe845024be in ffi_call_int.lto_priv.0 (/lib64/libffi.so.8+0x44be) (BuildId: f5312719df7de0c6ae9d42ed18680d8016bb59d4)
#18 0x7fbe8450518d in ffi_call (/lib64/libffi.so.8+0x718d) (BuildId: f5312719df7de0c6ae9d42ed18680d8016bb59d4)
#19 0x7fbe848fe842 in wl_closure_invoke.constprop.0 (/lib64/libwayland-server.so.0+0x9842) (BuildId: 5ba1da00efc72d602197f31c66d7d6516a9a62a3)
#20 0x7fbe849030b3 in wl_client_connection_data (/lib64/libwayland-server.so.0+0xe0b3) (BuildId: 5ba1da00efc72d602197f31c66d7d6516a9a62a3)
#21 0x7fbe849018e1 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0xc8e1) (BuildId: 5ba1da00efc72d602197f31c66d7d6516a9a62a3)
#22 0x7fbe84902124 in wl_display_run (/lib64/libwayland-server.so.0+0xd124) (BuildId: 5ba1da00efc72d602197f31c66d7d6516a9a62a3)
#23 0x7fbe8531d468 in wet_main ../compositor/main.c:4369
#24 0x40116a in main ../compositor/executable.c:33
#25 0x7fbe84a49b89 in __libc_start_call_main (/lib64/libc.so.6+0x27b89) (BuildId: 7026fe8c129a523e07856d7c96306663ceab6e24)
#26 0x7fbe84a49c4a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c4a) (BuildId: 7026fe8c129a523e07856d7c96306663ceab6e24)
#27 0x401084 in _start (/home/kira/opt/gfx/weston/build/compositor/weston+0x401084) (BuildId: d26bc6c92ffae07235b0fdfd3751e19b87681589)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../desktop-shell/shell.c:1565 in has_keyboard_focused_child_callback
==55003==ABORTING