From cab900e665b8cac44eaef282c1801bbc8f4b71c5 Mon Sep 17 00:00:00 2001 From: Anton Sotkov Date: Fri, 15 Jun 2018 06:26:29 +0300 Subject: [PATCH] Fix a crash on macOS 10.11. - `delegate` and `dataSource` are `assign` (not`weak`) on macOS 10.11. - `dataSource` was set to `nil` before `delegate`, and when `dataSource` is changed `NSTableView` notifies the `delegate` about removing all rows. - #58 introduced an issue where `_delegateDataSourceProxy` was released before setting `delegate` and `dataSource` to `nil`. - When `NSTableView` attempted to notify the `delegate` about removing all rows it was already released, which caused crashes. --- PXSourceList/PXSourceList.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PXSourceList/PXSourceList.m b/PXSourceList/PXSourceList.m index 2571c36..ca729cc 100644 --- a/PXSourceList/PXSourceList.m +++ b/PXSourceList/PXSourceList.m @@ -69,10 +69,10 @@ - (void)PXSL_setup - (void)dealloc { - _delegateDataSourceProxy = nil; //Remove ourselves as the delegate and data source to be safe - [super setDataSource:nil]; [super setDelegate:nil]; + [super setDataSource:nil]; + _delegateDataSourceProxy = nil; }