-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an experiment to remove extra collection teardown step #975
Conversation
…fy delegate proxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Source/Details/ASDataController.mm
Outdated
@@ -930,6 +930,8 @@ - (void)clearData | |||
ASDisplayNodeAssertMainThread(); | |||
if (_initialReloadDataHasBeenCalled) { | |||
[self waitUntilAllUpdatesAreProcessed]; | |||
auto vis = self.visibleMap; | |||
auto pending = self.pendingMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed!
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). |
Will try to review later, just passing by now - as usual, you can merge without me if others have looked at the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and agree with @appleguy around unknown crashes - would be interesting if we would could find a way to monitor that.
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]
indealloc
was migrated from a priorsuper.delegate = nil
which was there because at the time UICollectionView's delegate wasassign
and 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 isweak
and so this should no longer be a problem.I've removed these
set:nil
calls 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.