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 <[email protected]>

- - - - -


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
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to