macosx: Fix crashing when using the library window due to bad calls to setNativeVideoSize

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
Claudio Cambra 2023-02-03 02:51:41 +01:00 committed by Steve Lhomme
parent 4dd7d6788f
commit c4a8e8a054
1 changed files with 8 additions and 4 deletions

View File

@ -348,6 +348,10 @@ int WindowOpen(vlc_window_t *p_wnd)
if (!isEmbedded) {
[self setupWindowOriginForVideoWindow:videoWindow
atPosition:videoViewPosition];
if ([videoWindow isKindOfClass:[VLCAspectRatioRetainingVideoWindow class]]) {
[(VLCAspectRatioRetainingVideoWindow*)videoWindow setNativeVideoSize:videoViewSize];
}
}
// cascade windows if we have more than one vout
@ -355,8 +359,6 @@ int WindowOpen(vlc_window_t *p_wnd)
[self cascadeVoutWindowsForVideoWindow:videoWindow];
}
// resize window if it is an aspect ratio retaining window
[(VLCAspectRatioRetainingVideoWindow*)videoWindow setNativeVideoSize:videoViewSize];
[videoWindow makeKeyAndOrderFront: self];
}
@ -470,13 +472,15 @@ int WindowOpen(vlc_window_t *p_wnd)
- (void)setNativeVideoSize:(NSSize)size forWindow:(vlc_window_t *)p_wnd
{
VLCAspectRatioRetainingVideoWindow *o_window = [_voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
VLCVideoWindowCommon *o_window = [_voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
if (!o_window) {
msg_Err(getIntf(), "Cannot set size for nonexisting window");
return;
} else if (![o_window isKindOfClass:[VLCAspectRatioRetainingVideoWindow class]]) {
return;
}
[o_window setNativeVideoSize:size];
[(VLCAspectRatioRetainingVideoWindow*)o_window setNativeVideoSize:size];
}
- (void)setWindowLevel:(NSInteger)i_level forWindow:(vlc_window_t *)p_wnd