[vlc-commits] macosx: fixed race conditional crashes in PXSourceList (close #7171)

Felix Paul Kühne git at videolan.org
Fri Jul 27 20:44:10 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jul 27 15:41:53 2012 -0300| [50329a43138159395ad0e67f44a7a0c2815546f3] | committer: Felix Paul Kühne

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

Trust the ObjC runtime, it will do its job properly.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50329a43138159395ad0e67f44a7a0c2815546f3
---

 modules/gui/macosx/PXSourceList.m |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/modules/gui/macosx/PXSourceList.m b/modules/gui/macosx/PXSourceList.m
index 063d22b..cac5c04 100644
--- a/modules/gui/macosx/PXSourceList.m
+++ b/modules/gui/macosx/PXSourceList.m
@@ -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)] &&



More information about the vlc-commits mailing list