]> git.sesse.net Git - vlc/commitdiff
macosx: do not (mis)use the content view as the video view in fullscreen
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Thu, 20 Mar 2014 19:25:14 +0000 (20:25 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Thu, 20 Mar 2014 19:29:11 +0000 (20:29 +0100)
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.

modules/gui/macosx/Windows.m

index 2ef91dea128d0240c07334612dafaadd26b47ea3..9267c5b6d5cc63111ea7d777c869f789fe4b5f2d 100644 (file)
 
 - (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;
 }
             [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();
 
         [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();