summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr BrzeziƄski <piotr@centricular.com>2023-05-05 18:27:14 +0200
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-05-11 06:35:02 +0000
commit560d20a2c08dc77a4a6694d66aa8aaae637a7ec3 (patch)
tree81c9b2476aa021b590536a3765aae11c0d0ad113
parentad2d1ce3936c05a01ffa6e7990a8cdab4935a033 (diff)
downloadgstreamer-560d20a2c08dc77a4a6694d66aa8aaae637a7ec3.tar.gz
osxvideosink: fix deadlock upon closing output window
Invoking gst_osx_video_sink_osxwindow_destroy() can currently cause a deadlock because showFrame() keeps trying to get the same lock as well. Moving the lock closer to where it's actually needed seems to be enough to fix the issue for now. Reported-by: Alexande B <abobrikovich@gmail.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4559>
-rw-r--r--subprojects/gst-plugins-good/sys/osxvideo/osxvideosink.m5
1 files changed, 3 insertions, 2 deletions
diff --git a/subprojects/gst-plugins-good/sys/osxvideo/osxvideosink.m b/subprojects/gst-plugins-good/sys/osxvideo/osxvideosink.m
index b2c905cc43..4d5d2b4551 100644
--- a/subprojects/gst-plugins-good/sys/osxvideo/osxvideosink.m
+++ b/subprojects/gst-plugins-good/sys/osxvideo/osxvideosink.m
@@ -301,11 +301,9 @@ gst_osx_video_sink_osxwindow_destroy (GstOSXVideoSink * osxvideosink)
g_return_if_fail (GST_IS_OSX_VIDEO_SINK (osxvideosink));
pool = [[NSAutoreleasePool alloc] init];
- GST_OBJECT_LOCK (osxvideosink);
gst_osx_video_sink_call_from_main_thread(osxvideosink,
osxvideosink->osxvideosinkobject,
@selector(destroy), (id) nil, YES);
- GST_OBJECT_UNLOCK (osxvideosink);
#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
gst_osx_video_sink_stop_cocoa_loop (osxvideosink);
#endif
@@ -914,6 +912,7 @@ no_texture_buffer:
pool = [[NSAutoreleasePool alloc] init];
+ GST_OBJECT_LOCK (osxvideosink);
osxwindow = osxvideosink->osxwindow;
osxvideosink->osxwindow = NULL;
@@ -931,6 +930,8 @@ no_texture_buffer:
}
g_free (osxwindow);
}
+ GST_OBJECT_UNLOCK (osxvideosink);
+
[pool release];
}