-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent duplicate item deletes and drop reload collisions
Summary: a415ef5 exposed a bug in `UICollectionView` where its state gets corrupted when deleting the same index path more than once in a single batch update block. This resulted crashes like ``` * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x4) Closes #657 Reviewed By: jessesquires Differential Revision: D4913790 Pulled By: rnystrom fbshipit-source-id: 8f6fcdd2e2438da309fc64ca0ac111b9a0980149
- Loading branch information
1 parent
ad416ec
commit 073fc07
Showing
15 changed files
with
1,025 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
858 changes: 433 additions & 425 deletions
858
Examples/Examples-iOS/Pods/Pods.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
822 changes: 415 additions & 407 deletions
822
Examples/Examples-tvOS/Pods/Pods.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2016-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import <IGListKit/IGListMacros.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
An object with index path information for reloading an item during a batch update. | ||
*/ | ||
IGLK_SUBCLASSING_RESTRICTED | ||
@interface IGListReloadIndexPath : NSObject | ||
|
||
/** | ||
The index path of the item before batch updates are applied. | ||
*/ | ||
@property (nonatomic, strong, readonly) NSIndexPath *fromIndexPath; | ||
|
||
/** | ||
The index path of the item after batch updates are applied. | ||
*/ | ||
@property (nonatomic, strong, readonly) NSIndexPath *toIndexPath; | ||
|
||
/** | ||
Creates a new reload object. | ||
@param fromIndexPath The index path of the item before batch updates. | ||
@param toIndexPath The index path of the item after batch updates. | ||
@return A new reload object. | ||
*/ | ||
- (instancetype)initWithFromIndexPath:(NSIndexPath *)fromIndexPath | ||
toIndexPath:(NSIndexPath *)toIndexPath NS_DESIGNATED_INITIALIZER; | ||
|
||
/** | ||
:nodoc: | ||
*/ | ||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
/** | ||
:nodoc: | ||
*/ | ||
+ (instancetype)new NS_UNAVAILABLE; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) 2016-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "IGListReloadIndexPath.h" | ||
|
||
@implementation IGListReloadIndexPath | ||
|
||
- (instancetype)initWithFromIndexPath:(NSIndexPath *)fromIndexPath | ||
toIndexPath:(NSIndexPath *)toIndexPath { | ||
if (self = [super init]) { | ||
_fromIndexPath = fromIndexPath; | ||
_toIndexPath = toIndexPath; | ||
} | ||
return self; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.