Open ZevEisenberg opened 9 years ago
From UITableView.h in iOS 8.1:
@property (nonatomic, assign) id <UITableViewDataSource> dataSource;
Notice that it’s assign, not weak.
assign
weak
And in RZCollectionListTableViewDataSource.h:
- (void)dealloc { [self.collectionList removeCollectionListObserver:self]; }
-dealloc should also set the table view’s data source to nil. I’ve seen random objects have -tableView:cellForRowAtIndexPath: called on them, presumably because the table view’s delegate becomes a dangling pointer.
-dealloc
nil
-tableView:cellForRowAtIndexPath:
My suggestion:
- (void)dealloc { [self.collectionList removeCollectionListObserver:self]; self.tableView.dataSource = nil; }
@KingOfBrian take note for Assemblage. This is true of UICollectionView as well.
UICollectionView
Note: not an issue in iOS 9, where data sources are declared as weak instead of assign :tada:
From UITableView.h in iOS 8.1:
Notice that it’s
assign
, notweak
.And in RZCollectionListTableViewDataSource.h:
-dealloc
should also set the table view’s data source tonil
. I’ve seen random objects have-tableView:cellForRowAtIndexPath:
called on them, presumably because the table view’s delegate becomes a dangling pointer.My suggestion: