Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Commit cebe876

Browse files
algridjessesquires
authored andcommitted
Copy attributes before modifying in layout (#1868). Close #1218
1 parent eeebe7d commit cebe876

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

JSQMessagesViewController/Layout/JSQMessagesCollectionViewFlowLayout.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ - (void)prepareLayout
270270
CGFloat padding = -100.0f;
271271
CGRect visibleRect = CGRectInset(self.collectionView.bounds, padding, padding);
272272

273-
NSArray *visibleItems = [super layoutAttributesForElementsInRect:visibleRect];
273+
NSArray *visibleItems = [[NSArray alloc] initWithArray:[super layoutAttributesForElementsInRect:visibleRect] copyItems:YES];
274274
NSSet *visibleItemsIndexPaths = [NSSet setWithArray:[visibleItems valueForKey:NSStringFromSelector(@selector(indexPath))]];
275275

276276
[self jsq_removeNoLongerVisibleBehaviorsFromVisibleItemsIndexPaths:visibleItemsIndexPaths];
@@ -281,7 +281,7 @@ - (void)prepareLayout
281281

282282
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
283283
{
284-
NSArray *attributesInRect = [[super layoutAttributesForElementsInRect:rect] copy];
284+
NSArray *attributesInRect = [[NSArray alloc] initWithArray:[super layoutAttributesForElementsInRect:rect] copyItems:YES];
285285

286286
if (self.springinessEnabled) {
287287
NSMutableArray *attributesInRectCopy = [attributesInRect mutableCopy];

0 commit comments

Comments
 (0)