[vlc-commits] [Git][videolan/vlc][master] window_macosx: allow creating the window object from the main thread

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 15 06:04:37 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
03011572 by Alexandre Janniaux at 2025-05-15T05:48:12+00:00
window_macosx: allow creating the window object from the main thread

vlc_window objects have no specification of the thread running the code,
so we cannot dispatch_sync to main_thread without risking crashing.

- - - - -


1 changed file:

- modules/video_output/window_macosx.m


Changes:

=====================================
modules/video_output/window_macosx.m
=====================================
@@ -750,9 +750,13 @@ int Open(vlc_window_t *wnd)
         sys.delegate = moduleDelegate;
 
         __block VLCVideoStandaloneWindowController *windowController;
-        dispatch_sync(dispatch_get_main_queue(), ^{
+        if (CFRunLoopGetCurrent() != CFRunLoopGetMain())
+            dispatch_sync(dispatch_get_main_queue(), ^{
+                windowController = [[VLCVideoStandaloneWindowController alloc] initWithModuleDelegate:moduleDelegate];
+            });
+        else
             windowController = [[VLCVideoStandaloneWindowController alloc] initWithModuleDelegate:moduleDelegate];
-        });
+
         if (unlikely(windowController == nil))
             return VLC_ENOMEM;
         sys.windowController = windowController;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/03011572ba1bc550bfdf3f21b236a7bd681a4284

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/03011572ba1bc550bfdf3f21b236a7bd681a4284
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