You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.
So in the end we have situation when datasource is modified, [self reloadData] is not yet called, but then we ask collectionView about its cell state.
That situation is 100% crash. It doesn't happen only because numberOfItemsInSection uses cached information and doesn't asks dataSource delegate directly..
Also that situation in some cases prevents proper scrolling, because [self scrollToBottomAnimated:] may not "know" about last row that was just added (because reloadData is not yet called).
To reproduce the crash, just add (and keep forever) following line as first line of scrollToBottomAnimated:
When receiving new message we add message to data source (remember that!) and call
which calls
which in its first line sets
which in its last line calls
which asks collectionView about number of items in section:
So in the end we have situation when datasource is modified, [self reloadData] is not yet called, but then we ask collectionView about its cell state.
That situation is 100% crash. It doesn't happen only because numberOfItemsInSection uses cached information and doesn't asks dataSource delegate directly..
Also that situation in some cases prevents proper scrolling, because [self scrollToBottomAnimated:] may not "know" about last row that was just added (because reloadData is not yet called).
To reproduce the crash, just add (and keep forever) following line as first line of scrollToBottomAnimated:
It will effectively make any previous call to reloadData synchronous - it will wait for it to complete.
To fix the bug completely, in jsq_finishSendingOrReceivingMessage call reloadData before showTypingIndicator.
The text was updated successfully, but these errors were encountered: