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

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


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

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

Trust the ObjC runtime, it will do its job properly.
(cherry picked from commit 50329a43138159395ad0e67f44a7a0c2815546f3)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=3dfede2e5d9d115cfb4721b86d16240c56782ceb
---

 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 58737dc..505bfc5 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