]> git.sesse.net Git - vlc/commitdiff
macosx: fixed race conditional crashes in PXSourceList (close #7171)
authorFelix Paul Kühne <fkuehne@videolan.org>
Fri, 27 Jul 2012 18:41:53 +0000 (15:41 -0300)
committerFelix Paul Kühne <fkuehne@videolan.org>
Fri, 27 Jul 2012 18:42:23 +0000 (15:42 -0300)
Trust the ObjC runtime, it will do its job properly.

modules/gui/macosx/PXSourceList.m

index 063d22b4dc1eaa0ad47694da8619f3fe11f99184..cac5c0458dafb533f43b2611975e88a94ef5b921 100644 (file)
@@ -71,10 +71,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
 
 - (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
     [[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self];
 
@@ -83,10 +79,6 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
 
 - (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
     [[NSNotificationCenter defaultCenter] removeObserver:_secondaryDelegate name:nil object:self];
 
@@ -117,7 +109,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
 {
     _secondaryDataSource = aDataSource;
 
-    [self reloadData];
+    if ([self respondsToSelector:@selector(reloadData)])
+        [self reloadData];
 }
 
 - (void)setIconSize:(NSSize)newIconSize
@@ -138,7 +131,8 @@ NSString * const PXSLDeleteKeyPressedOnRowsNotification = @"PXSourceListDeleteKe
 
 - (void)reloadData
 {
-    [super reloadData];
+    if ([super respondsToSelector:@selector(reloadData)])
+        [super reloadData];
 
     //Expand items that are displayed as always expanded
     if([_secondaryDataSource conformsToProtocol:@protocol(PXSourceListDataSource)] &&