[vlc-commits] [Git][videolan/vlc][master] 8 commits: macosx: Do not re-instantiate audio view controller if that is already the...

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jan 12 07:48:37 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
67af4e2b by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not re-instantiate audio view controller if that is already the type of library view controller

This fixes issues when presenting library items, as the view controller
that is assigned to await the data source change before presenting the
given library item in the view gets dealloc'ed

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d7d04373 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not update presented audio view twice

Setting the library segment type property on the library window already
updates the presented view

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
19ae4910 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not reinstantiate playlist view controller if it is already the designated lvc

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1bd17a88 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not reinstantiate groups view controller if it is already the set lvc

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
c8a5a639 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Fix crash when presenting groups

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
9b3e9957 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not reinstantiate video view controller when presenting shows view if not necessary

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
08becb77 by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not reinstantiate video view controller when presenting videos view if not necessary

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
28a8a51e by Claudio Cambra at 2025-01-12T07:33:44+00:00
macosx: Do not reinstantiate home view controller when presenting home view if not necessary

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


2 changed files:

- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -395,37 +395,41 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 {
     // Only collection view mode
     [self.toolbarDelegate layoutForSegment:VLCLibraryHomeSegment];
-    VLCLibraryHomeViewController * const lvc =
-        [[VLCLibraryHomeViewController alloc] initWithLibraryWindow:self];
-    [lvc presentHomeView];
-    _librarySegmentViewController = lvc;
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryHomeViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryHomeViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryHomeViewController *)self.librarySegmentViewController presentHomeView];
 }
 
 - (void)showVideoLibrary
 {
     [self.toolbarDelegate layoutForSegment:VLCLibraryVideoSegment];
-    VLCLibraryVideoViewController * const lvc =
-        [[VLCLibraryVideoViewController alloc] initWithLibraryWindow:self];
-    [lvc presentVideoView];
-    _librarySegmentViewController = lvc;
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryVideoViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryVideoViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryVideoViewController *)self.librarySegmentViewController presentVideoView];
 }
 
 - (void)showShowLibrary
 {
     [self.toolbarDelegate layoutForSegment:VLCLibraryShowsVideoSubSegment];
-    VLCLibraryVideoViewController * const lvc =
-        [[VLCLibraryVideoViewController alloc] initWithLibraryWindow:self];
-    [lvc presentShowsView];
-    _librarySegmentViewController = lvc;
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryVideoViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryVideoViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryVideoViewController *)self.librarySegmentViewController presentShowsView];
 }
 
 - (void)showAudioLibrary
 {
     [self.toolbarDelegate layoutForSegment:VLCLibraryMusicSegment];
-    VLCLibraryAudioViewController * const lvc =
-        [[VLCLibraryAudioViewController alloc] initWithLibraryWindow:self];
-    [lvc presentAudioView];
-    _librarySegmentViewController = lvc;
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryAudioViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryAudioViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryAudioViewController *)self.librarySegmentViewController presentAudioView];
 }
 
 - (void)showPlaylistLibrary:(enum vlc_ml_playlist_type_t)playlistType
@@ -437,10 +441,12 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     } else {
         [self.toolbarDelegate layoutForSegment:VLCLibraryPlaylistsSegment];
     }
-    VLCLibraryPlaylistViewController * const lvc =
-        [[VLCLibraryPlaylistViewController alloc] initWithLibraryWindow:self];
-    [lvc presentPlaylistsViewForPlaylistType:playlistType];
-    _librarySegmentViewController = lvc;
+
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryPlaylistViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryPlaylistViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryPlaylistViewController *)self.librarySegmentViewController presentPlaylistsViewForPlaylistType:playlistType];
 }
 
 - (void)showMediaSourceLibrary
@@ -460,10 +466,11 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 - (void)showGroupsLibrary
 {
     [self.toolbarDelegate layoutForSegment:VLCLibraryGroupsSegment];
-    VLCLibraryGroupsViewController * const lvc =
-        [[VLCLibraryGroupsViewController alloc] initWithLibraryWindow:self];
-    [lvc presentGroupsView];
-    _librarySegmentViewController = lvc;
+    if (![self.librarySegmentViewController isKindOfClass:VLCLibraryGroupsViewController.class]) {
+        _librarySegmentViewController =
+            [[VLCLibraryGroupsViewController alloc] initWithLibraryWindow:self];
+    }
+    [(VLCLibraryGroupsViewController *)self.librarySegmentViewController presentGroupsView];
 }
 
 - (void)displayLibraryView:(NSView *)view
@@ -534,7 +541,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 - (void)presentGroupLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
 {
     [self showGroupsLibrary];
-    [(VLCLibraryAudioViewController *)self.librarySegmentViewController presentLibraryItem:libraryItem];
+    [(VLCLibraryGroupsViewController *)self.librarySegmentViewController presentGroup:libraryItem];
 }
 
 - (void)presentLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -512,7 +512,6 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
     VLCLibraryWindow * const libraryWindow = self.libraryWindow;
     libraryWindow.librarySegmentType = segmentType;
     [libraryWindow.splitViewController.navSidebarViewController selectSegment:segmentType];
-    [self updatePresentedView];
 }
 
 - (void)libraryModelUpdated:(NSNotification *)aNotification



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/280e11a5251c005eab9444f5087b9064efd67ec1...28a8a51e2fc5aca4449c8a41b5655a64c3b8dd66

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/280e11a5251c005eab9444f5087b9064efd67ec1...28a8a51e2fc5aca4449c8a41b5655a64c3b8dd66
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