[vlc-commits] macosx: fixed crash when setting up the video output

Felix Paul Kühne git at videolan.org
Wed Aug 22 15:26:55 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Aug 22 15:26:46 2012 +0200| [9dd2f6ed46b8c4bb0399693dbb3f91d7efbfabb0] | committer: Felix Paul Kühne

macosx: fixed crash when setting up the video output

AppKit could be accessed by a non-main-thread

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

 modules/gui/macosx/MainWindow.h |    2 +-
 modules/gui/macosx/MainWindow.m |    3 +--
 modules/gui/macosx/intf.m       |    3 ++-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
index d379ca1..89a9067 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -184,7 +184,7 @@
 - (void)drawFancyGradientEffectForTimeSlider;
 
 - (id)videoView;
-- (id)setupVideoView;
+- (void)setupVideoView;
 - (void)setVideoplayEnabled;
 - (void)resizeWindow;
 - (void)setNativeVideoSize:(NSSize)size;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index f2d0afc..0d2ea69 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1762,7 +1762,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     return o_video_view;
 }
 
-- (id)setupVideoView
+- (void)setupVideoView
 {
     // TODO: make lion fullscreen compatible with macosx-background and !embedded-video
     if( var_InheritBool( VLCIntf, "macosx-background" ) && !b_nativeFullscreenMode )
@@ -1851,7 +1851,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     }
 
     [[o_video_view window] setAlphaValue: config_GetFloat( VLCIntf, "macosx-opaqueness" )];
-    return o_video_view;
 }
 
 - (void)setVideoplayEnabled
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 190b2ab..82f25e6 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1783,7 +1783,8 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 
 - (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height
 {
-    id videoView = [o_mainwindow setupVideoView];
+    [o_mainwindow performSelectorOnMainThread:@selector(setupVideoView) withObject:nil waitUntilDone:YES];
+    id videoView = [o_mainwindow videoView];
     NSRect videoRect = [videoView frame];
     int i_x = (int)videoRect.origin.x;
     int i_y = (int)videoRect.origin.y;



More information about the vlc-commits mailing list