[XWayland] Crash on unmap window
While investigating #962 (closed) with xserver from current master (tip at 5b9010fa) I stumbled across a repeatable crash when closing the gamewindow.
valgrind gives:
==94345== Invalid write of size 8
==94345== at 0x44B001: __xorg_list_del (list.h:183)
==94345== by 0x44B001: xorg_list_del (list.h:204)
==94345== by 0x44B001: xwl_present_cleanup (xwayland-present.c:129)
==94345== by 0x445AFF: xwl_destroy_window (xwayland-window.c:763)
==94345== by 0x549D78: compDestroyWindow (compwindow.c:620)
==94345== by 0x5038F2: damageDestroyWindow (damage.c:1590)
==94345== by 0x4B98CD: DbeDestroyWindow (dbe.c:1326)
==94345== by 0x5841AA: FreeWindowResources (window.c:1018)
==94345== by 0x5871A2: DeleteWindow (window.c:1086)
==94345== by 0x5800BC: doFreeResource (resource.c:885)
==94345== by 0x580BFF: FreeResource (resource.c:915)
==94345== by 0x556B3C: ProcDestroyWindow (dispatch.c:779)
==94345== by 0x55C599: Dispatch (dispatch.c:497)
==94345== by 0x560433: dix_main (main.c:272)
==94345== Address 0x90a1630 is 144 bytes inside a block of size 160 free'd
==94345== at 0x483AA0C: free (vg_replace_malloc.c:540)
==94345== by 0x4460A6: xwl_unrealize_window (xwayland-window.c:614)
==94345== by 0x54A8F9: compUnrealizeWindow (compwindow.c:292)
==94345== by 0x58428B: UnrealizeTree (window.c:2805)
==94345== by 0x586FA1: UnmapWindow (window.c:2863)
==94345== by 0x556E2A: ProcUnmapWindow (dispatch.c:893)
==94345== by 0x55C599: Dispatch (dispatch.c:497)
==94345== by 0x560433: dix_main (main.c:272)
==94345== by 0x50DB1A2: (below main) (in /usr/lib64/libc-2.30.so)
==94345== Block was alloc'd at
==94345== at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==94345== by 0x44653E: ensure_surface_for_window (xwayland-window.c:439)
==94345== by 0x446AF7: xwl_window_set_window_pixmap (xwayland-window.c:640)
==94345== by 0x503049: damageSetWindowPixmap (damage.c:1565)
==94345== by 0x549994: compSetPixmapVisitWindow (compwindow.c:129)
==94345== by 0x584D73: TraverseTree (window.c:441)
==94345== by 0x584D73: TraverseTree (window.c:433)
==94345== by 0x54A67F: compSetPixmap (compwindow.c:151)
==94345== by 0x546F70: compAllocPixmap (compalloc.c:616)
==94345== by 0x54A85E: compRealizeWindow (compwindow.c:274)
==94345== by 0x583B61: RealizeTree (window.c:2606)
==94345== by 0x5869CC: MapWindow (window.c:2683)
==94345== by 0x5869CC: MapWindow (window.c:2654)
==94345== by 0x556D7E: ProcMapWindow (dispatch.c:859)
xwayland-present.c:129 is from commit c5067fea so maybe it is related.