UICollectionView: block gets NULL-ified after animation completes

Originator:parampampam
Number:rdar://14744561 Date Originated:15/08/2013
Status:Open Resolved:
Product:iPhone SDK Product Version:iOS 6.0+
Classification:Serious bug, crash Reproducible:Always
 
Summary:

When you use -[UICollectionView performBatchUpdates:completion:] method and collection view has no items insde it, that is, data source defines empty state, blocks should be captured by the `completion` block are NULL-ified after batch updates complete.

Steps to Reproduce:

1. Download modified CollectionView-Simple sample code and launch.
2. Tap of "Plus" button in the top-left corner.

Expected Results:

Visually nothing should change, "finished" should appear in the Console.

Actual Results:

Crash EXEC_BAD_ACCESS due to attempt to invoke a `block` which is suddenly equals to `nil`.

Regression:

Problem does not occur when data source defines non-empty state, that is, if you change collectionView:numberOfItemsInSection: to return non-zero value (1 for example, or 28 - default value for the CollectionView-Simple sample code).

Also, this bug affects iOS 6.0+.

Notes:

Please refer to the attached sample code: CollectionView-Simple-NULLifiedBlock.zip.

Comments

Discussion Thread and Sample Code

https://devforums.apple.com/thread/198531?tstart=0

By parampampam at Aug. 15, 2013, 12:33 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!