UITableViewController crashes in `setEditing:animated:` if reloadData is called within
Originator: | steipete | ||
Number: | rdar://32485481 | Date Originated: | 31-May-2017 03:27 PM |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | 10.3.2 |
Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary: Sending `reloadData` to a table view within `setEditing:animated:` of one of it's cells crashes in `setEditing:animated:` of the corresponding table view controller. Steps to Reproduce: 1. Open `EditingCrashExample` project 2. Build & Run 3. Tap Edit 4. Tap in one of the text fields to begin editing 5. Tap Done Expected Results: Exception with a descriptive message, something like "`reloadData` called while `setEditing:animated:` in progress”, or simply cancelling the endEditing process and reloading the data. Actual Results: Obscure range exception, stack trace doesn't reveal the problem. This took a while to find. Crash: 2017-05-31 15:26:34.844 EditingCrashExample[6505:2771628] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds for empty array' *** First throw call stack: ( 0 CoreFoundation 0x00000001019aeb0b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000101413141 objc_exception_throw + 48 2 CoreFoundation 0x00000001018e405b -[__NSArrayM objectAtIndex:] + 203 3 UIKit 0x0000000102c86f3f -[UITableView _setEditing:animated:forced:] + 816 4 UIKit 0x0000000102f43559 -[UITableViewController setEditing:animated:] + 113 5 UIKit 0x0000000102b29d22 -[UIApplication sendAction:to:from:forEvent:] + 83 6 UIKit 0x0000000102f645c7 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 149 7 UIKit 0x0000000102b29d22 -[UIApplication sendAction:to:from:forEvent:] + 83 8 UIKit 0x0000000102cae25c -[UIControl sendAction:to:forEvent:] + 67 9 UIKit 0x0000000102cae577 -[UIControl _sendActionsForEvents:withEvent:] + 450 10 UIKit 0x0000000102cae6eb -[UIControl _sendActionsForEvents:withEvent:] + 822 11 UIKit 0x0000000102cad4b2 -[UIControl touchesEnded:withEvent:] + 618 12 UIKit 0x0000000102b9749a -[UIWindow _sendTouchesForEvent:] + 2707 13 UIKit 0x0000000102b98bb0 -[UIWindow sendEvent:] + 4114 14 UIKit 0x0000000102b457b0 -[UIApplication sendEvent:] + 352 15 UIKit 0x0000000103328adc __dispatchPreprocessedEventFromEventQueue + 2926 16 UIKit 0x0000000103320a3a __handleEventQueue + 1122 17 CoreFoundation 0x0000000101954c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 18 CoreFoundation 0x000000010193a0cf __CFRunLoopDoSources0 + 527 19 CoreFoundation 0x00000001019395ff __CFRunLoopRun + 911 20 CoreFoundation 0x0000000101939016 CFRunLoopRunSpecific + 406 21 GraphicsServices 0x000000010580da24 GSEventRunModal + 62 22 UIKit 0x0000000102b280d4 UIApplicationMain + 159 23 EditingCrashExample 0x0000000100e4324f main + 111 24 libdyld.dylib 0x00000001028ec65d start + 1 25 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) Version: 10.3.2 Notes: https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/32481163%20-%20EditingCrashExample
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!