mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
waylandsink: release frame callback when destroyed
We would use a frame callback from the surface to indicate that last buffer is rendered, but when we destroy the surface and that callback is not back yet, it may cause the wayland event queue crash. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1729>
This commit is contained in:
parent
639fb6ac15
commit
6d8133e41e
3 changed files with 7 additions and 0 deletions
|
@ -637,6 +637,7 @@ frame_redraw_callback (void *data, struct wl_callback *callback, uint32_t time)
|
|||
|
||||
g_mutex_lock (&sink->render_lock);
|
||||
sink->redraw_pending = FALSE;
|
||||
sink->window->callback = NULL;
|
||||
g_mutex_unlock (&sink->render_lock);
|
||||
|
||||
wl_callback_destroy (callback);
|
||||
|
@ -660,6 +661,7 @@ render_last_buffer (GstWaylandSink * sink, gboolean redraw)
|
|||
|
||||
sink->redraw_pending = TRUE;
|
||||
callback = wl_surface_frame (surface);
|
||||
sink->window->callback = callback;
|
||||
wl_callback_add_listener (callback, &frame_callback_listener, sink);
|
||||
|
||||
if (G_UNLIKELY (sink->video_info_changed && !redraw)) {
|
||||
|
|
|
@ -157,6 +157,9 @@ gst_wl_window_finalize (GObject * gobject)
|
|||
{
|
||||
GstWlWindow *self = GST_WL_WINDOW (gobject);
|
||||
|
||||
if (self->callback)
|
||||
wl_callback_destroy (self->callback);
|
||||
|
||||
if (self->wl_shell_surface)
|
||||
wl_shell_surface_destroy (self->wl_shell_surface);
|
||||
|
||||
|
@ -197,6 +200,7 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
|
|||
window->render_lock = render_lock;
|
||||
g_cond_init (&window->configure_cond);
|
||||
|
||||
window->callback = NULL;
|
||||
window->area_surface = wl_compositor_create_surface (display->compositor);
|
||||
window->video_surface = wl_compositor_create_surface (display->compositor);
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ struct _GstWlWindow
|
|||
struct wl_shell_surface *wl_shell_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
struct wl_callback *callback;
|
||||
gboolean configured;
|
||||
GCond configure_cond;
|
||||
GMutex configure_mutex;
|
||||
|
|
Loading…
Reference in a new issue