-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
New issue checklist
- I have reviewed the
READMEand documentation - I have searched existing issues and this is not a duplicate
General information
IGListKitversion: 3.1.1- iOS version(s): iOS 10 & iOS 11
- Carthage version: 0.25
- Xcode version: Xcode 8 & Xcode 9
- Devices/Simulators affected: All devices and simulators
- Reproducible in the demo project? No (modified demo attached below).
- Related issues: NONE
Description
We use modified NestedAdapterViewController example. In subclass of ListSectionController we receive crash on sizeForItem(at: where we receive index out of bounds. We also receive crash on cellForItem(at with index out of bounds. It happens performUpdates from adapter, not reloadData.
I'm not sure if we use ListSectionController or adapter incorrectly or confirm it's a bug in IGListKit. I would be grateful for help.
Link to modified example:
https://github.com/rafalszastok/IGListKit/tree/crash-on-embedded-cells
Step to reproduce: After list of examples appears, select "Out custom example" at the bottom. It should crash automatically after few seconds.
Classes added to project:
- RailsViewController.swift
- RailSectionController.swift
- TileSectionController.swift
- ViewModels.swift
Modified:
- DemosViewController.swift
Edit
I did some changes and now example does the same as EmbeddedSectionController and this time I receive different error. In this case batch update doesn't finish before the next one starts. This cause the number of times isn't updated yet.
2017-10-04 10:11:37.168914+0200 IGListKitExamples[15977:1224786] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (4) must be equal to the number of sections contained in the collection view before the update (8), plus or minus the number of sections inserted or deleted (2 inserted, 1 deleted).'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ea181cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010e37af41 objc_exception_throw + 48
2 CoreFoundation 0x000000010ea1d362 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010de1f089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000110ce597f -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 15755
5 UIKit 0x0000000110cee5ad -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
6 UIKit 0x0000000110cee8f2 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 435
7 UIKit 0x0000000110cee71c -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
8 UIKit 0x0000000110cee69e -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
9 UIKit 0x0000000110cee5f3 -[UICollectionView performBatchUpdates:completion:] + 53
10 IGListKit 0x000000010db41267 __62-[IGListAdapterUpdater performBatchUpdatesWithCollectionView:]_block_invoke.118 + 567
11 IGListKit 0x000000010db3f9c6 -[IGListAdapterUpdater performBatchUpdatesWithCollectionView:] + 3958
12 IGListKit 0x000000010db43aef __54-[IGListAdapterUpdater queueUpdateWithCollectionView:]_block_invoke + 463
13 libdispatch.dylib 0x00000001126c93f7 _dispatch_call_block_and_release + 12
14 libdispatch.dylib 0x00000001126ca43c _dispatch_client_callout + 8
15 libdispatch.dylib 0x00000001126d56f0 _dispatch_main_queue_callback_4CF + 628
16 CoreFoundation 0x000000010e9daef9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
17 CoreFoundation 0x000000010e99f662 __CFRunLoopRun + 2402
18 CoreFoundation 0x000000010e99ea89 CFRunLoopRunSpecific + 409
19 GraphicsServices 0x0000000113dee9c6 GSEventRunModal + 62
20 UIKit 0x0000000110214d30 UIApplicationMain + 159
21 IGListKitExamples 0x000000010d6f5da7 main + 55
22 libdyld.dylib 0x0000000112746d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Branch:
https://github.com/rafalszastok/IGListKit/tree/crash-on-embedded-cells-2