Skip to content

caopengllayer: fix using layer outside of main thread

When stopping the playback, vout_display_t destructor will call the [VideoView vlcClose] which references the backing CALayer through [self layer]. This function is not thread-safe and should only be called from the main thread, leading to reports and crashes when using the main thread checker.

Instead, since we allocate the layer and references it from the vout_display_t implementation, just send the vlcClose message on the stored layer directly. Since it's only used to pass from the vd from the view to the layer, and it's initialized from a dispatch_sync() in the Open() function, there won't be race de-initializing them in a non-synchronized fashion like done in this commit.

Fixes #27513 (closed) Reference !1316 which would also changes that but is not easy to backport.

Merge request reports

Loading