[vlc-commits] macosx: simplify

Felix Paul Kühne git at videolan.org
Tue Jul 21 19:47:17 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jul 21 18:12:50 2015 +0200| [1a5b701e4900232b9401a9180750b1dc4adefecc] | committer: Felix Paul Kühne

macosx: simplify

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

 modules/gui/macosx/intf.m |   45 ++++++++++++++-------------------------------
 1 file changed, 14 insertions(+), 31 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 819529b..1425eeb 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -67,12 +67,6 @@
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
 #endif
 
-/*****************************************************************************
- * Local prototypes.
- *****************************************************************************/
-
-static VLCMain *sharedInstance = nil;
-
 #pragma mark -
 #pragma mark VLC Interface Object Callbacks
 
@@ -100,7 +94,6 @@ void CloseIntf (vlc_object_t *p_this)
     @autoreleasepool {
         msg_Dbg(p_this, "Closing macosx interface");
         [[VLCMain sharedInstance] applicationWillTerminate:nil];
-        sharedInstance = nil;
     }
 }
 
@@ -178,6 +171,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
 
 + (VLCMain *)sharedInstance
 {
+    static VLCMain *sharedInstance = nil;
     static dispatch_once_t pred;
 
     dispatch_once(&pred, ^{
@@ -191,38 +185,27 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
 {
     self = [super init];
 
-    p_intf = NULL;
+    if (self) {
+        p_intf = NULL;
 
-    [VLCApplication sharedApplication].delegate = self;
+        [VLCApplication sharedApplication].delegate = self;
 
-    /* announce our launch to a potential eyetv plugin */
-    [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"VLCOSXGUIInit"
-                                                                   object: @"VLCEyeTVSupport"
-                                                                 userInfo: NULL
-                                                       deliverImmediately: YES];
+        /* announce our launch to a potential eyetv plugin */
+        [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"VLCOSXGUIInit"
+                                                                       object: @"VLCEyeTVSupport"
+                                                                     userInfo: NULL
+                                                           deliverImmediately: YES];
 
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
-    [defaults registerDefaults:appDefaults];
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
+        [defaults registerDefaults:appDefaults];
 
-    _voutController = [[VLCVoutWindowController alloc] init];
+        _voutController = [[VLCVoutWindowController alloc] init];
+    }
 
     return self;
 }
 
-- (void)dealloc
-{
-    _mainmenu = nil;
-    _prefs = nil;
-    _sprefs = nil;
-    _open = nil;
-    _coredialogs = nil;
-    _bookmarks = nil;
-    _coreinteraction = nil;
-    _resume_dialog = nil;
-    _input_manager = nil;
-}
-
 - (void)setIntf: (intf_thread_t *)p_mainintf
 {
     p_intf = p_mainintf;



More information about the vlc-commits mailing list