[vlc-commits] [Git][videolan/vlc][master] gui: macosx: Fix a window restoration conflict with qt contrib
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Sep 3 11:59:24 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
4f6d5e41 by Maxime Chapelet at 2022-09-03T11:42:33+00:00
gui: macosx: Fix a window restoration conflict with qt contrib
Given vlc was launched on macOS with `-Iqt` arg, a segmentation fault appeared.
When Qt interface initialised, it unexpectedly called `-[VLCLibraryWindowController restoreWindowWithIdentifier:state:completionHandler:]` with the wrong identifier.
This was mainly due to the macOS window restoration mechanism.
- - - - -
1 changed file:
- modules/gui/macosx/library/VLCLibraryWindow.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -69,6 +69,7 @@ const CGFloat VLCLibraryWindowMinimalPlaylistWidth = 170.;
static NSArray<NSLayoutConstraint *> *videoPlaceholderImageViewSizeConstraints;
static NSArray<NSLayoutConstraint *> *audioPlaceholderImageViewSizeConstraints;
+static NSUserInterfaceItemIdentifier const kVLCLibraryWindowIdentifier = @"VLCLibraryWindow";
@interface VLCLibraryWindow () <VLCDragDropTarget, NSSplitViewDelegate>
{
@@ -130,6 +131,8 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
- (void)awakeFromNib
{
+ self.identifier = kVLCLibraryWindowIdentifier;
+
VLCMain *mainInstance = [VLCMain sharedInstance];
_playlistController = [mainInstance playlistController];
@@ -974,24 +977,26 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
state:(NSCoder *)state
completionHandler:(void (^)(NSWindow *, NSError *))completionHandler
{
+ if([identifier isEqualToString:kVLCLibraryWindowIdentifier] == NO) {
+ return;
+ }
+
if([VLCMain sharedInstance].libraryWindowController == nil) {
[VLCMain sharedInstance].libraryWindowController = [[VLCLibraryWindowController alloc] initWithLibraryWindow];
}
VLCLibraryWindow *libraryWindow = [VLCMain sharedInstance].libraryWindow;
- if([identifier isEqualToString:[libraryWindow identifier]]) {
- NSInteger rememberedSelectedLibrarySegment = [state decodeIntegerForKey:@"macosx-library-selected-segment"];
- NSInteger rememberedSelectedLibraryViewModeSegment = [state decodeIntegerForKey:@"macosx-library-view-mode-selected-segment"];
- NSInteger rememberedSelectedLibraryViewAudioSegment = [state decodeIntegerForKey:@"macosx-library-audio-view-selected-segment"];
+ NSInteger rememberedSelectedLibrarySegment = [state decodeIntegerForKey:@"macosx-library-selected-segment"];
+ NSInteger rememberedSelectedLibraryViewModeSegment = [state decodeIntegerForKey:@"macosx-library-view-mode-selected-segment"];
+ NSInteger rememberedSelectedLibraryViewAudioSegment = [state decodeIntegerForKey:@"macosx-library-audio-view-selected-segment"];
- [libraryWindow.segmentedTitleControl setSelectedSegment:rememberedSelectedLibrarySegment];
- [libraryWindow.gridVsListSegmentedControl setSelectedSegment:rememberedSelectedLibraryViewModeSegment];
- [libraryWindow.libraryAudioDataSource.segmentedControl setSelectedSegment:rememberedSelectedLibraryViewAudioSegment];
+ [libraryWindow.segmentedTitleControl setSelectedSegment:rememberedSelectedLibrarySegment];
+ [libraryWindow.gridVsListSegmentedControl setSelectedSegment:rememberedSelectedLibraryViewModeSegment];
+ [libraryWindow.libraryAudioDataSource.segmentedControl setSelectedSegment:rememberedSelectedLibraryViewAudioSegment];
- [libraryWindow segmentedControlAction:libraryWindow.navigationStack]; // Prevent actions being added to the nav stack
- [libraryWindow.libraryAudioDataSource segmentedControlAction:libraryWindow.navigationStack];
- }
+ [libraryWindow segmentedControlAction:libraryWindow.navigationStack]; // Prevent actions being added to the nav stack
+ [libraryWindow.libraryAudioDataSource segmentedControlAction:libraryWindow.navigationStack];
completionHandler(libraryWindow, nil);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4f6d5e413bc42754601ca411eb4eacd567ebba3c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4f6d5e413bc42754601ca411eb4eacd567ebba3c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list