mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
applemedia/avsample: Fix racy cleanup of CA layer
The block that is dispatched async to the main thread assumed the wrapping GstAvSampleVideoSink to be alive. However, at the time of the block execution the GstObject instance that is deferenced to access the CA layer might already be freed, which caused occasional crashes. Instead, we now only pass the CoreAnimation layer that needs to be released to the block. We use __block to make sure the block is not increasing the refcount of the CA layer again on its own. https://bugzilla.gnome.org/show_bug.cgi?id=753081
This commit is contained in:
parent
035e51b010
commit
0cc6d16c94
1 changed files with 3 additions and 2 deletions
|
@ -157,10 +157,11 @@ static void
|
|||
gst_av_sample_video_sink_finalize (GObject * object)
|
||||
{
|
||||
GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (object);
|
||||
__block AVSampleBufferDisplayLayer *layer = av_sink->layer;
|
||||
|
||||
if (av_sink->layer) {
|
||||
if (layer) {
|
||||
dispatch_async (dispatch_get_main_queue (), ^{
|
||||
[av_sink->layer release];
|
||||
[layer release];
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue