Skip to content

ASCollectionLayout to return a zero content size if its state is unavailable - #509

Merged
nguyenhuy merged 3 commits into
TextureGroup:masterfrom
nguyenhuy:HNHandleUnavaiLayoutState
Aug 17, 2017
Merged

nguyenhuy merged 3 commits into
TextureGroup:masterfrom
nguyenhuy:HNHandleUnavaiLayoutState

Conversation

@nguyenhuy

Copy link
Copy Markdown
Member

Reported by @wsdwsd0829 here.

Reproducible in "examples/ASCollectionView" by enabling ASYNC_COLLECTION_LAYOUT and popping the view controller after just 2 seconds (this line
). The crash occurs when a containing view controller is popped out right after its collection view finished a batch update, but before an update animation settles. As soon as the view controller is deallocated, its collection view's layout is invalidated. Then when the update animation stops, it asks for the layout's content size and triggers the assertion. Fix by returning a zero size instead.

@Adlai-Holler Adlai-Holler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down with this

Comment thread Source/Private/ASCollectionLayout.mm Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that we don't regress on this in the future, could you add a link to this PR explaining the workaround?

@nguyenhuy
nguyenhuy force-pushed the HNHandleUnavaiLayoutState branch from 1863575 to bc24130 Compare August 16, 2017 10:38
@nguyenhuy

Copy link
Copy Markdown
Member Author

Thanks, @Adlai-Holler!

@nguyenhuy
nguyenhuy merged commit 46e9494 into TextureGroup:master Aug 17, 2017
@nguyenhuy
nguyenhuy deleted the HNHandleUnavaiLayoutState branch August 17, 2017 13:43
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants