libweston/desktop/xdg-shell: Fixed invalid parent for pop-ups
This adds a backpointer to be able to check when commit happens that the parent is still valid.
Fixes the following crash:
==60591==ERROR: AddressSanitizer: heap-use-after-free on address 0x50f000084358 at pc 0x7f5dfc594bb2 bp 0x7ffd51794370 sp 0x7ffd51794368
READ of size 8 at 0x50f000084358 thread T0
#0 0x7f5dfc594bb1 in weston_desktop_xdg_popup_update_position ../libweston/desktop/xdg-shell.c:1077
#1 0x7f5dfc5949a8 in weston_desktop_xdg_popup_committed ../libweston/desktop/xdg-shell.c:1056
#2 0x7f5dfc598d02 in weston_desktop_xdg_surface_committed ../libweston/desktop/xdg-shell.c:1542
#3 0x7f5dfc58016e in weston_desktop_surface_surface_committed ../libweston/desktop/surface.c:196
#4 0x7f5dfc473840 in wl_signal_emit /usr/include/wayland-server-core.h:513
#5 0x7f5dfc4b5417 in weston_surface_commit_state ../libweston/compositor.c:4898
#6 0x7f5dfc4b56b3 in weston_surface_commit ../libweston/compositor.c:4913
#7 0x7f5dfc4b6459 in surface_commit ../libweston/compositor.c:4998
#8 0x7f5dfc915055 in ffi_call_unix64 (/lib64/libffi.so.8+0x9055) (BuildId: a190bf03e644181cadab122962ab83ae96271696)
#9 0x7f5dfc91169f in ffi_call_int.lto_priv.0 (/lib64/libffi.so.8+0x569f) (BuildId: a190bf03e644181cadab122962ab83ae96271696)
#10 0x7f5dfc9144ed in ffi_call (/lib64/libffi.so.8+0x84ed) (BuildId: a190bf03e644181cadab122962ab83ae96271696)
#11 0x7f5dfd74cb22 in wl_closure_invoke.constprop.0 (/lib64/libwayland-server.so.0+0x6b22) (BuildId: 24125e1697bee5514c95cc823de5e1adbd8c96f2)
#12 0x7f5dfd751831 in wl_client_connection_data (/lib64/libwayland-server.so.0+0xb831) (BuildId: 24125e1697bee5514c95cc823de5e1adbd8c96f2)
#13 0x7f5dfd74fc91 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0x9c91) (BuildId: 24125e1697bee5514c95cc823de5e1adbd8c96f2)
#14 0x7f5dfd751cf4 in wl_display_run (/lib64/libwayland-server.so.0+0xbcf4) (BuildId: 24125e1697bee5514c95cc823de5e1adbd8c96f2)
#15 0x7f5dfcf5e253 in wet_main ../frontend/main.c:4779
Signed-off-by: Marius Vlad marius.vlad@collabora.com
Edited by Marius Vlad