Commit 50329a43 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed race conditional crashes in PXSourceList (close #7171)

Trust the ObjC runtime, it will do its job properly.
parent 731de0e9
...@@ -71,10 +71,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe ...@@ -71,10 +71,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
- (void)dealloc - (void)dealloc
{ {
//Remove ourselves as the delegate and data source to be safe
[super setDataSource:nil];
[super setDelegate:nil];
//Unregister the delegate from receiving notifications //Unregister the delegate from receiving notifications
[[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self]; [[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self];
...@@ -83,10 +79,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe ...@@ -83,10 +79,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
- (void)finalize - (void)finalize
{ {
//Remove ourselves as the delegate and data source to be safe
[super setDataSource:nil];
[super setDelegate:nil];
//Unregister the delegate from receiving notifications //Unregister the delegate from receiving notifications
[[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self]; [[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self];
...@@ -117,7 +109,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe ...@@ -117,7 +109,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
{ {
_secondaryDataSource = aDataSource; _secondaryDataSource = aDataSource;
[self reloadData]; if ([self respondsToSelector:@selector(reloadData)])
[self reloadData];
} }
- (void)setIconSize:(NSSize)newIconSize - (void)setIconSize:(NSSize)newIconSize
...@@ -138,7 +131,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe ...@@ -138,7 +131,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
- (void)reloadData - (void)reloadData
{ {
[super reloadData]; if ([super respondsToSelector:@selector(reloadData)])
[super reloadData];
//Expand items that are displayed as always expanded //Expand items that are displayed as always expanded
if([_secondaryDataSource conformsToProtocol:@protocol(PXSourceListDataSource)] && if([_secondaryDataSource conformsToProtocol:@protocol(PXSourceListDataSource)] &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment