From cbdeaf9a97a79a205c15940deaaafb6c48ff64af Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Thu, 14 Apr 2016 09:56:11 +0300 Subject: [PATCH] [ios] Fixed crash. MWMMapDownloaderViewController retains its dataSources. However its tableView does not retain its dataSource. During switch of active dataSource, tableView was loosing its dataSource. Table reload during dataSource switch led to crashes. --- .../MapDownloader/MWMBaseMapDownloaderViewController.mm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm index 0804ea8e77..a8b1adecdf 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm @@ -636,13 +636,12 @@ using namespace storage; - (void)setDataSource:(MWMMapDownloaderDataSource *)dataSource { - self.tableView.dataSource = dataSource; self.forceFullReload = YES; -} -- (MWMMapDownloaderDataSource *)dataSource -{ - return static_cast(self.tableView.dataSource); + // Order matters. _dataSource must be set last since self.tableView does not retain dataSource. + // In different order outdated datasource gets reclaimed between assignments. + self.tableView.dataSource = dataSource; + _dataSource = dataSource; } #pragma mark - Helpers