Create an experiment to remove extra collection teardown step - #975
Merged
Conversation
…fy delegate proxy
nguyenhuy
approved these changes
Jun 19, 2018
nguyenhuy
left a comment
Member
There was a problem hiding this comment.
LGTM overall, although it would be great if we have a test case to prevent regressions like this in the future. Not a blocking issue though.
| if (_initialReloadDataHasBeenCalled) { | ||
| [self waitUntilAllUpdatesAreProcessed]; | ||
| auto vis = self.visibleMap; | ||
| auto pending = self.pendingMap; |
Member
|
This is good, definitely running as an experiment is important as we've been encountering a range of hard-to-anticipate crashes from background deallocation (deeper instance variables like an NSMutableDictionary holding UIGestureRecognizers are not handled by default). |
Member
|
Will try to review later, just passing by now - as usual, you can merge without me if others have looked at the code. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently we have an issue where the background deallocation of most cell nodes is not happening, because of the following stack:
This subtle issue was introduced in #797.
Having dug through the history, the
[setAsyncDataSource:nil]indeallocwas migrated from a priorsuper.delegate = nilwhich was there because at the time UICollectionView's delegate wasassignand so there were crashes when the collection view would outlive the delegate, and try to call out to a dangling pointer. Since iOS 9, collection view delegate isweakand so this should no longer be a problem.I've removed these
set:nilcalls from the dealloc methods, behind a new experiment calledexp_collection_teardown. As always, the default behavior is unaffected.I'd like for this to work as-is, so that it becomes easier to reason about collection view teardown and it gets us back our background deallocation. If we find issues, we'll work through them.
As a small ridealong, I removed repeated access to weak variables in the delegate proxies. Should be a little faster and more reliable.