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

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


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Aug 22 15:48:01 2012 +0200| [d83976cd2d5cdeba6bbf749ab19cfb2836e036f1] | committer: Felix Paul Kühne

macosx: fixed crash when setting up the video output

AppKit could be accessed by a non-main-thread

This is a manual backport of 9dd2f6ed46b8c4bb0399693dbb3f91d7efbfabb0

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

 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 3946aff..c02da14 100644
--- a/modules/gui/macosx/MainWindow.h
+++ b/modules/gui/macosx/MainWindow.h
@@ -175,7 +175,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 751bf62..d22ceb7 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1568,7 +1568,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     return o_video_view;
 }
 
-- (id)setupVideoView
+- (void)setupVideoView
 {
     vout_thread_t *p_vout = getVout();
     if ((var_InheritBool( VLCIntf, "embedded-video" ) || b_nativeFullscreenMode) && b_video_deco)
@@ -1619,7 +1619,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
             [[o_video_view window] setLevel: NSNormalWindowLevel];
         vlc_object_release( p_vout );
     }
-    return o_video_view;
 }
 
 - (void)setVideoplayEnabled
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 41823a3..99b0b46 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1769,7 +1769,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