applemedia/avsample: Fix racy cleanup of CA layer
authorHeinrich Fink <hfink@toolsonair.com>
Thu, 30 Jul 2015 21:31:21 +0000 (23:31 +0200)
committerMatthew Waters <matthew@centricular.com>
Fri, 31 Jul 2015 02:59:00 +0000 (12:59 +1000)
commit0cc6d16c94d0e5ab09167b3a8d03ed0531c8f795
tree78996f8c1b044a778435d3df23be9fa8da435b70
parent035e51b010a93ab85ffb812770a9d9d7d66afce9
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
sys/applemedia/avsamplevideosink.m