diff --git a/Source/IGListDiffKit/IGListExperiments.h b/Source/IGListDiffKit/IGListExperiments.h index e0413bd7a..a85f2edea 100644 --- a/Source/IGListDiffKit/IGListExperiments.h +++ b/Source/IGListDiffKit/IGListExperiments.h @@ -20,8 +20,6 @@ typedef NS_OPTIONS (NSInteger, IGListExperiment) { IGListExperimentInvalidateLayoutForUpdates = 1 << 2, /// Throw NSInternalInconsistencyException during an update IGListExperimentThrowOnInconsistencyException = 1 << 3, - /// Test keeping a strong pointer to the collectionView.dataSource during a batch update to avoid a crash - IGListExperimentKeepPointerToCollectionViewDataSource = 1 << 4, }; /** diff --git a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m index 14fd9da0d..51c56a15b 100644 --- a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m +++ b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m @@ -136,11 +136,10 @@ - (void)_didDiff:(IGListIndexSetResult *)diffResult onBackground:(BOOL)onBackgro [self.delegate listAdapterUpdater:self.updater didDiffWithResults:diffResult onBackgroundThread:onBackground]; @try { - // Experiment with keeping a pointer to the self.collectionView.dataSource, because we're seeing a crash where it could be missing. - const BOOL keepDataSource = IGListExperimentEnabled(self.config.experiments, IGListExperimentKeepPointerToCollectionViewDataSource); - id const collectionViewDataSource = keepDataSource ? self.collectionView.dataSource : nil; - - if (self.collectionView.dataSource == nil || (keepDataSource && collectionViewDataSource == nil)) { + // Keeping a pointer to self.collectionView.dataSource, because it can get deallocated before the UICollectionView and crash + id const collectionViewDataSource = self.collectionView.dataSource; + + if (collectionViewDataSource == nil) { // If the data source is nil, we should not call any collection view update. [self _bail]; } else if (diffResult.changeCount > 100 && self.config.allowsReloadingOnTooManyUpdates) {