when received xdg config event fron wayland server,
gst_wl_display_thread_run will call handle_xdg_surface_configure
which protected by priv->sync_mutex.
and in handle_xdg_surface_configure, configure_mutex also is locked
but if waylandsink set state from paused to ready, that will dispose
wlwindow, which will try to clear configure_mutex, and try to destroy
xdg_surface,
that do not proteced by anything.
so, problem is:
1) if clear configure_mutex(with locked state), clear lock will abort
2) after xdg_surface destroy, handle_xdg_surface_config may still call
ack_configure, that will lead wayland server go wrong
so, this patch updates gst_wl_window_finalize to use the new
destruction function for xdg_toplevel and xdg_surface, ensuring all
destruction operations are properly synchronized.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8242>