Error sending UITableView message to freed UIViewController

I struggled with the next stack trace of the whole day. I cannot reproduce the problem, but I know that this is happening for a large number of users (Crashlytics).

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000010

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x0000000194187bd0 objc_msgSend + 16
1  UIKit                          0x000000018860639c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 544
2  UIKit                          0x00000001885fafc4 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2360
3  UIKit                          0x00000001883f0c60 -[UITableView layoutSubviews] + 172
4  UIKit                          0x000000018830d874 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572
5  QuartzCore                     0x0000000187c65d58 -[CALayer layoutSublayers] + 168
6  QuartzCore                     0x0000000187c60944 CA::Layer::layout_if_needed(CA::Transaction*) + 320
7  QuartzCore                     0x0000000187c607e8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
8  QuartzCore                     0x0000000187c5ffe8 CA::Context::commit_transaction(CA::Transaction*) + 276
9  QuartzCore                     0x0000000187c5fd6c CA::Transaction::commit() + 436
10 UIKit                          0x0000000188304848 _afterCACommitHandler + 156
11 CoreFoundation                 0x0000000183b46388 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
12 CoreFoundation                 0x0000000183b43314 __CFRunLoopDoObservers + 360
13 CoreFoundation                 0x0000000183b436f4 __CFRunLoopRun + 836

...

This happens in the UIViewController to which the UITableView belongs. The view controller is also the data source and delegate for the presentation of the table.

Looking at the stack trace, I assumed that the view manager would be freed while animation or slow work was going on. After trying everything, I can’t find the configuration where this will happen.

Do you have any assumptions about why VC can be released while one of its species is still reviving?

+4
1

, UITableViewController UIViewController + UITableView.

, UITableViewController , . .

, nil - (void)dealloc:

- (void)dealloc {
    _tableView.dataSource = nil;
    _tableView.delegate = nil;
}

, nil, , UITableView dataSource, _ .

+8

All Articles