[vlc-commits] [Git][videolan/vlc][master] macosx: Ensure all layout attributes used and modified from super class are...

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Thu Sep 12 04:37:29 UTC 2024



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


Commits:
d4d879a8 by Claudio Cambra at 2024-09-12T04:22:30+00:00
macosx: Ensure all layout attributes used and modified from super class are copied in collection view flow layout

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

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
=====================================
@@ -236,12 +236,12 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
 
 - (NSCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
 {
-    NSCollectionViewLayoutAttributes *attributes = [super layoutAttributesForItemAtIndexPath:indexPath];
-
     if(_selectedIndexPath == nil || indexPath == _selectedIndexPath) {
-        return attributes;
+        return [super layoutAttributesForItemAtIndexPath:indexPath];
     }
 
+    NSCollectionViewLayoutAttributes * const attributes =
+        [super layoutAttributesForItemAtIndexPath:indexPath].copy;
     [attributes setFrame:[self frameForDisplacedAttributes:attributes]];
     return attributes;
 }
@@ -255,9 +255,10 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
     NSRect selectedItemFrame = [[self layoutAttributesForItemAtIndexPath:_selectedIndexPath] frame];
 
     // Computed attributes from parent
-    NSMutableArray<__kindof NSCollectionViewLayoutAttributes *> *layoutAttributesArray = [[super layoutAttributesForElementsInRect:rect] mutableCopy];
+    NSMutableArray<__kindof NSCollectionViewLayoutAttributes *> * const layoutAttributesArray =
+        [super layoutAttributesForElementsInRect:rect].mutableCopy;
     for (int i = 0; i < layoutAttributesArray.count; i++) {
-        NSCollectionViewLayoutAttributes * const attributes = layoutAttributesArray[i];
+        NSCollectionViewLayoutAttributes * const attributes = layoutAttributesArray[i].copy;
         NSString * const elementKind = attributes.representedElementKind;
 
         if (@available(macOS 10.12, *)) {
@@ -328,8 +329,8 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
     }
 
     // Default attributes
-    NSCollectionViewLayoutAttributes *attributes = [super layoutAttributesForSupplementaryViewOfKind:elementKind
-                                                                                         atIndexPath:indexPath];
+    NSCollectionViewLayoutAttributes * const attributes =
+        [super layoutAttributesForSupplementaryViewOfKind:elementKind atIndexPath:indexPath].copy;
     [attributes setFrame:[self frameForDisplacedAttributes:attributes]];
     return attributes;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d4d879a8ae340efaea47d4abf12597e81d652167

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d4d879a8ae340efaea47d4abf12597e81d652167
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