Rightpoint / RZCollectionList

A framework for dealing with displaying data from Core Data and other sources in UITableViews.
Other
43 stars 8 forks source link

RZCollectionListTableViewDataSource doesn’t nil table view’s data source #61

Open ZevEisenberg opened 9 years ago

ZevEisenberg commented 9 years ago

From UITableView.h in iOS 8.1:

@property (nonatomic, assign)   id <UITableViewDataSource> dataSource;

Notice that it’s assign, not 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.

My suggestion:

- (void)dealloc
{
    [self.collectionList removeCollectionListObserver:self];
    self.tableView.dataSource = nil;
}
ZevEisenberg commented 9 years ago

@KingOfBrian take note for Assemblage. This is true of UICollectionView as well.

ZevEisenberg commented 9 years ago

Note: not an issue in iOS 9, where data sources are declared as weak instead of assign :tada: