Skip to content

[3.0.x] caopengllayer: fix using layer outside of main thread

Felix Paul Kühne requested to merge fkuehne/vlc:bp-4974 into 3.0.x

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)

(cherry picked from commit 79e1535a) (back-port of !4974 (merged))

Merge request reports