Defer invalidatation until all batch updates are finished#931
Closed
rnystrom wants to merge 3 commits into
Closed
Conversation
Contributor
|
@rnystrom updated the pull request - view changes |
Contributor
|
I am still quite new to iOS development. May I ask what you mean with 'dumping the UICollectionView internals confirms'. How would this work or is it done? Are you dumping the assembly? |
Contributor
Author
|
|
||
| - Weakly reference the `UICollectionView` in coalescence so that it can be released if the rest of system is destroyed. [Ryan Nystrom](https://github.com/rnystrom) [(#tbd)](https://github.com/Instagram/IGListKit/pull/tbd) | ||
|
|
||
| - Avoid crash when invalidating the layout while inside `-[UICollectionView performBatchUpdates:completion:]. [Ryan Nystrom](https://github.com/rnystrom) [(#tbd)](https://github.com/Instagram/IGListKit/pull/tbd) |
Contributor
There was a problem hiding this comment.
missed backtick here `
Contributor
|
@rnystrom has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
2 tasks
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.

Changes in this pull request
Added a mechanism to
IGListAdapterto defer (queue or execute) blocks around asking the updater to do batch updates. I discovered a crash where the_updateCompletionHandler(private ivar) ofUICollectionViewwas not being niled when two batch updates collide. There is an assert in-[UICollectionView dealloc]that fires if this block != nil. Took some reverse eng to track down what is happening.Sadly I cannot reproduce the issue in a unit test or sample app. However I can 100% repro this in my GitHawk app. Applying this patch fixes the problem. I added a unit test that got me close to the state of the crash. Consider this new test future-proofing (also covers the enter/exit/defer stuff).
Also dumping the
UICollectionViewinternals confirms that the bad state (_updateCompletionHandler != nil) is no longer true.Issue fixed: #929
Depends on #930
Checklist
CHANGELOG.mdfor any breaking changes, enhancements, or bug fixes.