diff --git a/CHANGELOG.md b/CHANGELOG.md index 3701bce94..85b2f0843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ - Optimize layout process by removing `ASRectMap`. [Adlai Holler](https://github.com/Adlai-Holler) - Remove necessity to use view to access rangeController in ASTableNode, ASCollectionNode. [Michael Schneider](https://github.com/maicki) - Remove display node's reliance on shared_ptr. [Adlai Holler](https://github.com/Adlai-Holler) +- [ASCollectionView] Fix a crash that is caused by clearing a collection view's data while it's still being used. [Huy Nguyen](https://github.com/nguyenhuy) [#1154](https://github.com/TextureGroup/Texture/pull/1154) - Clean up timing of layout tree flattening/ copying of unflattened tree for Weaver. [Michael Zuccarino](https://github.com/mikezucc) [#1157](https://github.com/TextureGroup/Texture/pull/1157) ## 2.7 diff --git a/Schemas/configuration.json b/Schemas/configuration.json index 29c4375a4..33b1f43c3 100644 --- a/Schemas/configuration.json +++ b/Schemas/configuration.json @@ -21,7 +21,8 @@ "exp_network_image_queue", "exp_dealloc_queue_v2", "exp_collection_teardown", - "exp_framesetter_cache" + "exp_framesetter_cache", + "exp_clear_data_during_deallocation" ] } } diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 94406b0ee..0c36204a0 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -577,7 +577,7 @@ - (void)_asyncDelegateOrDataSourceDidChange { ASDisplayNodeAssertMainThread(); - if (_asyncDataSource == nil && _asyncDelegate == nil && !ASActivateExperimentalFeature(ASExperimentalSkipClearData)) { + if (_asyncDataSource == nil && _asyncDelegate == nil && _isDeallocating && ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) { [_dataController clearData]; } } diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 2af937d66..626975636 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -23,7 +23,7 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { ASExperimentalNetworkImageQueue = 1 << 5, // exp_network_image_queue ASExperimentalCollectionTeardown = 1 << 6, // exp_collection_teardown ASExperimentalFramesetterCache = 1 << 7, // exp_framesetter_cache - ASExperimentalSkipClearData = 1 << 8, // exp_skip_clear_data + ASExperimentalClearDataDuringDeallocation = 1 << 8, // exp_clear_data_during_deallocation ASExperimentalFeatureAll = 0xFFFFFFFF }; diff --git a/Source/ASExperimentalFeatures.m b/Source/ASExperimentalFeatures.m index b5751c873..73abea48b 100644 --- a/Source/ASExperimentalFeatures.m +++ b/Source/ASExperimentalFeatures.m @@ -21,7 +21,7 @@ @"exp_dealloc_queue_v2", @"exp_collection_teardown", @"exp_framesetter_cache", - @"exp_skip_clear_data"])); + @"exp_clear_data_during_deallocation"])); if (flags == ASExperimentalFeatureAll) { return allNames;