[Backport to xwayland-22.1] xwayland: Delay wl_surface destruction
X11 and Wayland requests are unordered, causing a race in the X11 window and wl_surface association.
To mitigate that race, delay the wl_surface destruction by 1 second, so that the compositor has time to establish the association before the wl_surface is destroyed: to see both the wl_surface created and the WL_SURFACE_ID X11 property set.
This is only a mitigation though, a more robust solution requires a future dedicated Wayland protocol.
v2: Clean up pending wl_surface destroy on exit as well.
Closes: #1157 (closed)
Signed-off-by: Olivier Fourdan ofourdan@redhat.com
Suggested-by: Pekka Paalanen pekka.paalanen@collabora.com
Reviewed-by: Michel Dänzer mdaenzer@redhat.com
Tested-by: Joshua Ashton joshua@froggi.es
Tested-by: Sterophonick sterophonick@gmail.com
See-also: wayland/wayland-protocols!163 (merged)
(cherry picked from commit e37f18ee)