summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2024-04-02 12:25:08 +1100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-04-15 15:28:44 +0000
commit84acc6a6d3049f8f3b9ca5baedf344eba84e324a (patch)
treef16de2c065c4465f45ed6061bbcd420e585aea39
parent8cacf850fee78679219fb62f8bc5cb0acf78dcc4 (diff)
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/6566>
-rw-r--r--subprojects/gst-plugins-base/ext/gl/gstglimagesink.c9
1 files 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