From 84acc6a6d3049f8f3b9ca5baedf344eba84e324a Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 2 Apr 2024 12:25:08 +1100 Subject: 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: --- subprojects/gst-plugins-base/ext/gl/gstglimagesink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-base/ext/gl/gstglimagesink.c b/subprojects/gst-plugins-base/ext/gl/gstglimagesink.c index bf0ee8b14b..74a959b3c1 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstglimagesink.c +++ b/subprojects/gst-plugins-base/ext/gl/gstglimagesink.c @@ -1004,12 +1004,17 @@ gst_glimage_sink_mouse_scroll_event_cb (GstGLWindow * window, static void _set_context (GstGLImageSink * gl_sink, GstGLContext * context) { + GstGLContext *old_context; + GST_GLIMAGE_SINK_LOCK (gl_sink); - if (gl_sink->context) - gst_object_unref (gl_sink->context); + 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 -- cgit v1.2.3-70-g09d2