[vlc-commits] macosx: do not (mis)use the content view as the video view in fullscreen

David Fuhrmann git at videolan.org
Thu Mar 20 20:30:12 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Mar 20 20:25:14 2014 +0100| [a34b8d76ed70d534773c82b64f5936660063ca38] | committer: David Fuhrmann

macosx: do not (mis)use the content view as the video view in fullscreen

The content view can never be nil, so methods like removeFromSuperView
which are used do not work as expected. Thus, it was possible that the
content view is a dangling pointer, causing crashes when trying to draw
the window.

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

 modules/gui/macosx/Windows.m |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 2ef91de..9267c5b 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -223,8 +223,13 @@
 
 - (VLCVoutView *)videoView
 {
-    if ([[self contentView] class] == [VLCVoutView class])
-        return (VLCVoutView *)[self contentView];
+    NSArray *o_subViews = [[self contentView] subviews];
+    if ([o_subViews count] > 0) {
+        id o_vout_view = [o_subViews objectAtIndex:0];
+
+        if ([o_vout_view class] == [VLCVoutView class])
+            return (VLCVoutView *)o_vout_view;
+    }
 
     return nil;
 }
@@ -900,7 +905,8 @@
             [o_video_view retain];
             [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
             [o_temp_view setFrame:[o_video_view frame]];
-            [o_fullscreen_window setContentView:o_video_view];
+            [[o_fullscreen_window contentView] addSubview:o_video_view];
+            [o_video_view setFrame: [[o_fullscreen_window contentView] frame]];
             [o_video_view release];
             NSEnableScreenUpdates();
 
@@ -928,7 +934,8 @@
         [o_video_view retain];
         [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
         [o_temp_view setFrame:[o_video_view frame]];
-        [o_fullscreen_window setContentView:o_video_view];
+        [[o_fullscreen_window contentView] addSubview:o_video_view];
+        [o_video_view setFrame: [[o_fullscreen_window contentView] frame]];
         [o_video_view release];
         [o_fullscreen_window makeKeyAndOrderFront:self];
         NSEnableScreenUpdates();



More information about the vlc-commits mailing list