glimagesink: unref the potential last ref outside of the glimagesink lock

Avoids a deadlock between the state change removing the last ref and
the destructer calling the window's on_close handler and trying to
take the glimagesink lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6504>
This commit is contained in:
Matthew Waters 2024-04-02 12:25:08 +11:00 committed by GStreamer Marge Bot
parent 3c5bb4bf5d
commit d9b563e9b2

View file

@ -1004,12 +1004,17 @@ gst_glimage_sink_mouse_scroll_event_cb (GstGLWindow * window,
static void
_set_context (GstGLImageSink * gl_sink, GstGLContext * context)
{
GST_GLIMAGE_SINK_LOCK (gl_sink);
if (gl_sink->context)
gst_object_unref (gl_sink->context);
GstGLContext *old_context;
GST_GLIMAGE_SINK_LOCK (gl_sink);
old_context = gl_sink->context;
gl_sink->context = context;
GST_GLIMAGE_SINK_UNLOCK (gl_sink);
if (old_context)
gst_object_unref (old_context);
}
static void