[vlc-commits] [Git][videolan/vlc][master] caopengllayer: fix using layer outside of main thread

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Wed Feb 21 16:59:42 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
79e1535a by Alexandre Janniaux at 2024-02-21T16:43:32+00:00
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

- - - - -


1 changed file:

- modules/video_output/caopengllayer.m


Changes:

=====================================
modules/video_output/caopengllayer.m
=====================================
@@ -479,6 +479,7 @@ static void Close(vout_display_t *vd)
     vout_display_sys_t *sys = vd->sys;
 
     atomic_store(&sys->is_ready, false);
+    [sys->videoLayer vlcClose];
     [sys->videoView vlcClose];
 
     if (sys->vgl && !vlc_gl_MakeCurrent(sys->gl)) {
@@ -623,7 +624,6 @@ static int Control (vout_display_t *vd, int query)
 - (void)vlcClose
 {
     @synchronized (self) {
-        [(VLCCAOpenGLLayer *)self.layer vlcClose];
         _vlc_vd = NULL;
     }
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/79e1535af5937901636529930a52e70546c6fec5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/79e1535af5937901636529930a52e70546c6fec5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list