xmartlabs / Eureka

Elegant iOS form builder in Swift
https://eurekacommunity.github.io
MIT License
11.78k stars 1.33k forks source link

Crash in MultipleSelectorViewController.section(with:header:footer:) on row selection #2186

Closed chickendiver closed 3 years ago

chickendiver commented 3 years ago

Environment Info Eureka version: 5.3.4 XCode version: 13.0 iOS version: 14.7.1

Description I have this crash popping up in our crash reporting tool, but cannot reproduce in QA. It appears as though the crash is being triggered when the user selects a row.

We are using the MultipleSelectorViewController in two places within the application. I can provide more information about the code as needed.

Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x39408 _assertionFailure(_:_:flags:) + 792
1  libswiftCore.dylib             0x17bb18 ELEMENT_TYPE_OF_SET_VIOLATES_HASHABLE_REQUIREMENTS(_:) + 3688
2  libswiftCore.dylib             0x17cfe8 _NativeSet.insertNew(_:at:isUnique:) + 716
3  libswiftCore.dylib             0x1b5af0 Set._Variant.insert(_:) + 1136
4  Eureka                         0x5f55c closure #1 in closure #1 in _MultipleSelectorViewController.section(with:header:footer:) + 116 (MultipleSelectorViewController.swift:116)
5  Eureka                         0x864e4 closure #1 in SelectableSectionType<>.prepare(selectableRows:) + 106 (SelectableSection.swift:106)
6  Eureka                         0x6fd94 closure #1 in RowType<>.onRowValidationChanged(_:) + 255 (RowType.swift:255)
7  Eureka                         0x6affc Row.didSelect() + 190 (Row.swift:190)
8  Eureka                         0x19378 FormViewController.tableView(_:didSelectRowAt:) + 795 (Core.swift:795)
9  Eureka                         0x19434 @objc FormViewController.tableView(_:didSelectRowAt:) + 4315370548 (<compiler-generated>:4315370548)
10 UIKitCore                      0xddd3a8 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:] + 1072
11 UIKitCore                      0xddcf50 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 112
12 UIKitCore                      0xddd710 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 272
13 UIKitCore                      0x10a7e70 -[_UIAfterCACommitBlock run] + 72
14 UIKitCore                      0xbda89c _runAfterCACommitDeferredBlocks + 300
15 UIKitCore                      0xbc9214 _cleanUpAfterCAFlushAndRunDeferredBlocks + 204
16 UIKitCore                      0xbfd0e8 _afterCACommitHandler + 80
17 CoreFoundation                 0xa2c74 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
18 CoreFoundation                 0x9cd98 __CFRunLoopDoObservers + 572
19 CoreFoundation                 0x9d344 __CFRunLoopRun + 1052
20 CoreFoundation                 0x9c9f4 CFRunLoopRunSpecific + 600
21 GraphicsServices               0x3734 GSEventRunModal + 164
22 UIKitCore                      0xbca75c -[UIApplication _run] + 1072
23 UIKitCore                      0xbcffcc UIApplicationMain + 168
REDACTED
25 libdyld.dylib                  0x1cf8 start + 4
mats-claassen commented 3 years ago

Hi @chickendiver, looking at the stack trace it seems that:

Eureka actually enforces the value of each row in the MultipleSelectorViewController is Hashable. But maybe in your case something weird is happening there? Could you make sure that in all possible cases, all options passed to the MultipleSelectorViewController are Hashable?

chickendiver commented 3 years ago

Aha! Perfect, thank you. It turns out that the error was resulting from inserting a duplicate of one of my hashable objects.