Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keep pointer to self.collectionView.dataSource in IGListBatchUpdateTr…
…ansaction Summary: ## Issue We're seeing crashes like this one: ``` Invalid batch updates detected: the number of sections and/or items returned by the data source before and after performing the batch updates are inconsistent with the updates. Data source before updates = { 6 sections with item counts: [1, 0, 6, 8, 5, 7] } Data source after updates = { 1 section with item counts: [0] } Updates = [ ] ``` I'm thinking the `IGListAdapter` gets deallocated during an update. 1. `1 section with item counts: [0]` is the default when the `self.collectionView.dataSource` is `nil`. I don't really see a way we'd return a single section with zero cells. 2. We're not seeing any of the additional crash information set by the `IGListAdapterUpdaterDelegate`, which would happen if `IGListAdapter` gets deallocated (it holds the strong pointer to the delegate). ## Fix Lets keep a strong pointer within the scope of the function to make sure it sticks around. Theoretically, there could be a situation where the section-controller holds a strong pointer to the list-adapter in an update block, which gets released after it runs. This seems pretty unlikely, so lets test this fix to see if that's it. Reviewed By: candance Differential Revision: D52747014 fbshipit-source-id: 545aaa3deb90af85a011e716ac870659da42106f
- Loading branch information