[vlc-commits] macosx: Use unsafe_unretained instead of weak for controller vars

David Fuhrmann git at videolan.org
Mon Oct 30 12:19:01 CET 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Mon Oct 30 12:11:22 2017 +0100| [905709d6e19cb032a9c646a6c7fc18282b021d16] | committer: David Fuhrmann

macosx: Use unsafe_unretained instead of weak for controller vars

weak is not supported for NSWindowController instances on Lion, using
it crashes VLC on 10.7.

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

 modules/gui/macosx/VLCAudioEffectsWindowController.m   | 8 ++++----
 modules/gui/macosx/VLCConvertAndSaveWindowController.m | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/VLCAudioEffectsWindowController.m b/modules/gui/macosx/VLCAudioEffectsWindowController.m
index e337395e2c..89f7744453 100644
--- a/modules/gui/macosx/VLCAudioEffectsWindowController.m
+++ b/modules/gui/macosx/VLCAudioEffectsWindowController.m
@@ -479,7 +479,7 @@
     [_textfieldPanel setCancelButtonString:_NS("Cancel")];
     [_textfieldPanel setOkButtonString:_NS("Save")];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
 
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -533,7 +533,7 @@
     [_popupPanel setCancelButtonString:_NS("Cancel")];
     [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"AudioEffectProfileNames"]];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
 
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -788,7 +788,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
     [_textfieldPanel setCancelButtonString:_NS("Cancel")];
     [_textfieldPanel setOkButtonString:_NS("Save")];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 
@@ -834,7 +834,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
     [_popupPanel setCancelButtonString:_NS("Cancel")];
     [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
 
         if (returnCode != NSOKButton)
diff --git a/modules/gui/macosx/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
index 55000072b7..d03c1e679f 100644
--- a/modules/gui/macosx/VLCConvertAndSaveWindowController.m
+++ b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
@@ -339,7 +339,7 @@
     [_popupPanel setCancelButtonString:_NS("Cancel")];
     [_popupPanel setPopupButtonContent:self.profileNames];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
 
         if (returnCode != NSOKButton)
@@ -475,7 +475,7 @@
     [_textfieldPanel setCancelButtonString: _NS("Cancel")];
     [_textfieldPanel setOkButtonString: _NS("Save")];
 
-    __weak typeof(self) _self = self;
+    __unsafe_unretained typeof(self) _self = self;
     [_textfieldPanel runModalForWindow:_customizePanel completionHandler:^(NSInteger returnCode, NSString *resultingText) {
         if (returnCode != NSOKButton || [resultingText length] == 0)
             return;



More information about the vlc-commits mailing list