Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: Calling update_table_data with an index path while searching causes crash #660

Closed
jamonholmgren opened this issue Apr 1, 2015 · 2 comments
Labels

Comments

@jamonholmgren
Copy link
Owner

Workaround: call update_table_data without any arguments.

Full crash report:

2015-03-31 17:22:54.975 Beast Mode[38710:1472205] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3318.93/UITableView.m:1582
2015-03-31 17:22:55.166 Beast Mode[38710:1472205] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (5) must be equal to the number of rows contained in that section before the update (83), plus or minus the number of rows inserted or deleted from that section (1 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000105201a75 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010115bbb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001052018da +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00000001029fbb6f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x000000010174f57a -[UITableView _endCellAnimationsWithContext:] + 11746
    5   Beast Mode                          0x0000000100168ae4 __unnamed_196 + 52
    6   Beast Mode                          0x0000000100740588 rb_vm_dispatch + 6280
    7   Beast Mode                          0x000000010014e7d3 vm_dispatch + 1443
    8   Beast Mode                          0x0000000100397260 rb_scope__update_table_view_data:__ + 1168
    9   Beast Mode                          0x00000001007409bc rb_vm_dispatch + 7356
    10  Beast Mode                          0x000000010014e7d3 vm_dispatch + 1443
    11  Beast Mode                          0x0000000100399079 rb_scope__update_table_data:__ + 393
    12  Beast Mode                          0x00000001007409bc rb_vm_dispatch + 7356
    13  Beast Mode                          0x000000010014e7d3 vm_dispatch + 1443
    14  Beast Mode                          0x000000010061b4c1 rb_scope__user_follow_changed:__ + 625
    15  Beast Mode                          0x00000001007409bc rb_vm_dispatch + 7356
    16  Beast Mode                          0x00000001007372f5 send_internal + 741
    17  Beast Mode                          0x00000001007403f2 rb_vm_dispatch + 5874
    18  Beast Mode                          0x000000010014e7d3 vm_dispatch + 1443
    19  Beast Mode                          0x0000000100397777 rb_scope__trigger_action:__ + 935
    20  Beast Mode                          0x00000001007409bc rb_vm_dispatch + 7356
    21  Beast Mode                          0x000000010014e7d3 vm_dispatch + 1443
    22  Beast Mode                          0x000000010039ba62 rb_scope__tableView:didSelectRowAtIndexPath:__ + 610
    23  Beast Mode                          0x000000010039baed __unnamed_183 + 61
    24  UIKit                               0x0000000101762ce3 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1293
    25  UIKit                               0x0000000101762e24 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
    26  UIKit                               0x000000010169dadb _applyBlockToCFArrayCopiedToStack + 314
    27  UIKit                               0x000000010169d955 _afterCACommitHandler + 516
    28  CoreFoundation                      0x0000000105136507 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    29  CoreFoundation                      0x0000000105136460 __CFRunLoopDoObservers + 368
    30  CoreFoundation                      0x000000010512c293 __CFRunLoopRun + 1123
    31  CoreFoundation                      0x000000010512bbc6 CFRunLoopRunSpecific + 470
    32  GraphicsServices                    0x0000000106c86a58 GSEventRunModal + 161
    33  UIKit                               0x000000010167a580 UIApplicationMain + 1282
    34  Beast Mode                          0x0000000100157b25 main + 117
    35  libdyld.dylib                       0x0000000105fd2145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

================================================================================
The application terminated. A crash report file may have been generated by the
system, use `rake crashlog' to open it. Use `rake debug=1' to restart the app
in the debugger.
================================================================================
@jamonholmgren
Copy link
Owner Author

Also running into another issue like that:

        update_table_data(index_paths: [0, index].nsindexpath, animation: :fade.uitablerowanimation)
Exception Type:  SIGABRT
Exception Codes: #0 at 0x3376cdf0
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber section]: unrecognized selector sent to instance 0x18a8fc0'

Last Exception Backtrace:
0   CoreFoundation                       0x24bc8fef __exceptionPreprocess + 127
1   libobjc.A.dylib                      0x33116c8b objc_exception_throw + 36
2   CoreFoundation                       0x24bce409 -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                       0x24bcc327 ___forwarding___ + 712
4   CoreFoundation                       0x24afbe78 _CF_forwarding_prep_0 + 22
5   UIKit                                0x283e447f -[UITableView _endCellAnimationsWithContext:] + 1068
6   Beast Mode                           0x00139951 __unnamed_103 + 10
7   Beast Mode                           0x005807b5 rb_vm_dispatch + 5338
8   Beast Mode                           0x001245bb vm_dispatch + 728
9   Beast Mode                           0x002dfefb rb_scope__update_table_view_data:__ (table.rb:114)
10  Beast Mode                           0x00580afd rb_vm_dispatch + 6178
11  Beast Mode                           0x001245bb vm_dispatch + 728
12  Beast Mode                           0x002e0819 rb_scope__update_table_data:__ (table.rb:146)
13  Beast Mode                           0x00580afd rb_vm_dispatch + 6178
14  Beast Mode                           0x001245bb vm_dispatch + 728
15  Beast Mode                           0x003fdfbb rb_scope__liked_video:__block__ (video_list_helpers.rb:23)

@andrewhavens
Copy link
Collaborator

I have been running into a similar issue as well. https://github.com/infinitered/ProMotion/blob/master/lib/ProMotion/table/table.rb#L120

@table_search_display_controller.searchResultsTableView.reloadData if searching?

If searching returns true, but @table_search_display_controller is nil, you'll get:

undefined method `searchResultsTableView' for nil:NilClass (NoMethodError)

I'm not exactly sure how I'm getting into this scenario. I have a custom search implemented, so there may be some accidental overlap. I think the user starts searching before the table has fetched the remote data, then calls update_table_data when the results are returned. I think the remote data is expecting to call table_view.reloadData, but the last line of that method also gets called on a nil object.

I'm guessing if we just check for nil before calling that method then it will fix my problem. I switched to using table_view.reloadData in the mean time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants