[vlc-commits] [Git][videolan/vlc][master] 2 commits: macos: prevent crash when unfavoriting selected item

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Sep 13 09:46:42 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
ed076ba2 by Serhii Bykov at 2026-09-13T11:27:21+02:00
macos: prevent crash when unfavoriting selected item

- - - - -
a120e152 by Serhii Bykov at 2026-09-13T11:27:21+02:00
macos: avoid stale favorite detail view on unfavorite

- - - - -


1 changed file:

- modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesDataSource.m


Changes:

=====================================
modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesDataSource.m
=====================================
@@ -276,6 +276,10 @@ NSString * const VLCLibraryFavoritesDataSourceDisplayedCollectionChangedNotifica
     }
 
     [_collectionViewFlowLayout resetLayout];
+    NSSet<NSIndexPath *> * const selectedIndexPaths = self.collectionView.selectionIndexPaths;
+    if (selectedIndexPaths.count > 0) {
+        [self.collectionView deselectItemsAtIndexPaths:selectedIndexPaths];
+    }
 
     _favoriteVideoMediaArray = [self.libraryModel listOfFavoriteVideoMedia];
     _favoriteAudioMediaArray = [self.libraryModel listOfFavoriteAudioMedia];
@@ -514,7 +518,12 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
                                            forIndexPath:indexPath];
         
         const id<VLCMediaLibraryItemProtocol> item = [self libraryItemAtIndexPath:indexPath forCollectionView:collectionView];
-        VLCLibraryRepresentedItem * const representedItem = [[VLCLibraryRepresentedItem alloc] initWithItem:item parentType:self.currentParentType];
+        if (item == nil || item.firstMediaItem == nil) {
+            return nil;
+        }
+
+        const VLCMediaLibraryParentGroupType parentType = [self parentTypeForSection:section];
+        VLCLibraryRepresentedItem * const representedItem = [[VLCLibraryRepresentedItem alloc] initWithItem:item parentType:parentType];
 
         mediaItemSupplementaryDetailView.representedItem = representedItem;
         mediaItemSupplementaryDetailView.selectedItem = [collectionView itemAtIndexPath:indexPath];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/51329f1d315b0ff818631125be266a2905547554...a120e15284d47db593718bc6234a81cd60690ba5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/51329f1d315b0ff818631125be266a2905547554...a120e15284d47db593718bc6234a81cd60690ba5
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list