[vlc-commits] gui: minimal_macosx: init window on main thread

Marvin Scholz git at videolan.org
Wed Aug 1 01:15:17 CEST 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Aug  1 01:11:35 2018 +0200| [6e068064e1ec2a98a14b41eac0a459e26dea198a] | committer: Marvin Scholz

gui: minimal_macosx: init window on main thread

The window, being UI, has to be created on the main thread.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6e068064e1ec2a98a14b41eac0a459e26dea198a
---

 modules/gui/minimal_macosx/intf.m | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/gui/minimal_macosx/intf.m b/modules/gui/minimal_macosx/intf.m
index beb503af21..111857b83f 100644
--- a/modules/gui/minimal_macosx/intf.m
+++ b/modules/gui/minimal_macosx/intf.m
@@ -105,10 +105,13 @@ static int WindowControl(vout_window_t *, int i_query, va_list);
 int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
 {
     @autoreleasepool {
+        VLCMinimalVoutWindow __block *o_window;
         NSRect proposedVideoViewPosition = NSMakeRect(cfg->x, cfg->y, cfg->width, cfg->height);
 
-        VLCMinimalVoutWindow *o_window = [[VLCMinimalVoutWindow alloc] initWithContentRect:proposedVideoViewPosition];
-        [o_window makeKeyAndOrderFront:nil];
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            o_window = [[VLCMinimalVoutWindow alloc] initWithContentRect:proposedVideoViewPosition];
+            [o_window makeKeyAndOrderFront:nil];
+        });
 
         if (!o_window) {
             msg_Err(p_wnd, "window creation failed");



More information about the vlc-commits mailing list