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 X11 DestroyNotify can be processed by the X11 window manager before the Wayland object ID gets reused.
This is only a mitigation though, a more robust solution requires a future dedicated Wayland protocol.
Closes: #1157 (closed)
Signed-off-by: Olivier Fourdan ofourdan@redhat.com
Suggested-by: Pekka Paalanen pekka.paalanen@collabora.com
See-also: wayland/wayland-protocols!163 (merged)
\cc: @pq @JoshuaAshton
Note: This is a stop gap solution which is meant to be backported to the current stable releases - I expect this mechanism to be superseded by the new Wayland protocol from wayland/wayland-protocols!163 (merged) in the next major release of Xwayland for the compositors that support it.
Note 2: This is untested.