NSCollectionView ignores -reloadData when not currently in a window
Originator: | iospiritongt | ||
Number: | rdar://33919372 | Date Originated: | 16-Aug.-2017 06:04 PM |
Status: | Open | Resolved: | |
Product: | macOS + SDK | Product Version: | 10.13 beta 6 (17A344b) |
Classification: | Serious Bug | Reproducible: | Always |
Summary: I use NSCollectionViews in view controllers that go on and off screen. Some of these view controllers tracks events in the system and update their contents accordingly. I discovered that, when they do so while currently not in a window, calls to -[NSCollectionView reloadData] are ignored, leading to a crash as the respective view controllers come back into view, since the view controller's model is now out of sync with what the collection view assumes about it (in terms of number of items, number of sections, ..) Steps to Reproduce: 1) Display content with NSCollectionView 2) Move collection view off-window 3) Change model data and call -reloadData on NSCollectionView Expected Results: NSCollectionView invalidates its internal state and requests new data from the data source either immediately or when moving back into a window Actual Results: NSCollectionView seems to ignore -reloadData, accessing objects at index paths that are no longer valid, leading to a crash. Version: 10.13 beta 6 (17A344b) Notes:
Comments
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!