wayland: fix crash issue during stop flow

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>
This commit is contained in:
Qian Hu (胡骞) 2025-02-24 09:53:48 +08:00 committed by GStreamer Marge Bot
parent 308540c2fe
commit 6d17596777

View File

@ -195,6 +195,10 @@ gst_wl_window_finalize (GObject * gobject)
gst_wl_display_callback_destroy (priv->display, &priv->frame_callback);
gst_wl_display_callback_destroy (priv->display, &priv->commit_callback);
gst_wl_display_object_destroy (priv->display,
(gpointer *) & priv->xdg_toplevel, (GDestroyNotify) xdg_toplevel_destroy);
gst_wl_display_object_destroy (priv->display,
(gpointer *) & priv->xdg_surface, (GDestroyNotify) xdg_surface_destroy);
if (priv->staged_buffer)
gst_wl_buffer_unref_buffer (priv->staged_buffer);
@ -203,11 +207,6 @@ gst_wl_window_finalize (GObject * gobject)
g_mutex_clear (&priv->configure_mutex);
g_mutex_clear (&priv->window_lock);
if (priv->xdg_toplevel)
xdg_toplevel_destroy (priv->xdg_toplevel);
if (priv->xdg_surface)
xdg_surface_destroy (priv->xdg_surface);
if (priv->video_viewport)
wp_viewport_destroy (priv->video_viewport);