mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
osxvideosink: fix segfault releasing the sink
show_frame is deferred to the main thread and can be called when the sink has been released, so we need to keep an extra ref on ObjectiveC object helper. https://bugzilla.gnome.org/show_bug.cgi?id=708501
This commit is contained in:
parent
141a1fc296
commit
05f6c094fa
1 changed files with 10 additions and 2 deletions
|
@ -330,9 +330,11 @@ 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);
|
||||
gst_osx_video_sink_stop_cocoa_loop (osxvideosink);
|
||||
[pool release];
|
||||
}
|
||||
|
@ -779,10 +781,15 @@ gst_osx_video_sink_get_type (void)
|
|||
-(id) initWithSink: (GstOSXVideoSink*) sink
|
||||
{
|
||||
self = [super init];
|
||||
self->osxvideosink = sink;
|
||||
self->osxvideosink = gst_object_ref (sink);
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc {
|
||||
gst_object_unref (osxvideosink);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void) createInternalWindow
|
||||
{
|
||||
GstOSXWindow *osxwindow = osxvideosink->osxwindow;
|
||||
|
@ -896,6 +903,7 @@ gst_osx_video_sink_get_type (void)
|
|||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
GstBuffer *buf = object->buf;
|
||||
|
||||
GST_OBJECT_LOCK (osxvideosink);
|
||||
if (osxvideosink->osxwindow != NULL)
|
||||
{
|
||||
gst_buffer_map (buf, &info, GST_MAP_READ);
|
||||
|
@ -910,7 +918,7 @@ gst_osx_video_sink_get_type (void)
|
|||
gst_buffer_unmap (buf, &info);
|
||||
}
|
||||
}
|
||||
|
||||
GST_OBJECT_UNLOCK (osxvideosink);
|
||||
[object release];
|
||||
|
||||
[pool release];
|
||||
|
|
Loading…
Reference in a new issue