macOS: Do not form weak reference to NSWindowController
authorMarvin Scholz <epirat07@gmail.com>
Sat, 24 Jun 2017 10:35:42 +0000 (12:35 +0200)
committerMarvin Scholz <epirat07@gmail.com>
Sat, 24 Jun 2017 10:36:33 +0000 (12:36 +0200)
Use __unsafe_unretained instead of __weak, as we need to support 10.7
and it is not supported to form a weak reference to some types,
including NSWindowController, resulting in a runtime crash.

modules/gui/macosx/VLCVideoEffectsWindowController.m

index a95e28f..79f5f1d 100644 (file)
     [_textfieldPanel setCancelButtonString:_NS("Cancel")];
     [_textfieldPanel setOkButtonString:_NS("Save")];
 
-    __weak typeof(self) _self = self;
+    // TODO: Change to weak, when dropping 10.7 support
+    __unsafe_unretained typeof(self) _self = self;
     [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
 
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     [_popupPanel setCancelButtonString:_NS("Cancel")];
     [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"VideoEffectProfileNames"]];
 
-    __weak typeof(self) _self = self;
+    // TODO: Change to weak, when dropping 10.7 support
+    __unsafe_unretained typeof(self) _self = self;
     [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
 
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];