[vlc-commits] macosx: remove o_appLock, rename f_appExit

David Fuhrmann git at videolan.org
Sat Jun 20 12:40:42 CEST 2015


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jun 20 12:30:28 2015 +0200| [25f5b20564641617bd4e871ea8fa1e04a83cfb95] | committer: David Fuhrmann

macosx: remove o_appLock, rename f_appExit

Lock is not needed anymore, as this variable is only accessed
from the main thread.

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

 modules/gui/macosx/intf.h |    2 ++
 modules/gui/macosx/intf.m |   19 +++----------------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index bbb5283..f8e6517 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -98,6 +98,8 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
     IBOutlet VLCControls * o_controls;     /* VLCControls    */
     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
 
+    bool b_intf_terminating; /* Makes sure applicationWillTerminate will be called only once */
+
     AppleRemote * o_remote;
     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
 
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index d5b864d..3d901d8 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -102,7 +102,6 @@ static int BossCallback(vlc_object_t *, const char *,
 
 static atomic_bool b_intf_starting = ATOMIC_VAR_INIT(false);
 
-static NSLock * o_appLock = nil;    // controls access to f_appExit
 static NSLock * o_vout_provider_lock = nil;
 
 
@@ -119,7 +118,6 @@ int OpenIntf (vlc_object_t *p_this)
 
     [VLCApplication sharedApplication];
 
-    o_appLock = [[NSLock alloc] init];
     o_vout_provider_lock = [[NSLock alloc] init];
 
     [[VLCMain sharedInstance] setIntf: p_intf];
@@ -141,7 +139,6 @@ void CloseIntf (vlc_object_t *p_this)
 
     msg_Dbg(p_this, "Closing macosx interface");
     [[VLCMain sharedInstance] applicationWillTerminate:nil];
-    [o_appLock release];
     [o_vout_provider_lock release];
     o_vout_provider_lock = nil;
     [o_pool release];
@@ -812,29 +809,19 @@ static VLCMain *_o_sharedMainInstance = nil;
     PL_UNLOCK;
 }
 
-/* don't allow a double termination call. If the user has
- * already invoked the quit then simply return this time. */
-static bool f_appExit = false;
-
 #pragma mark -
 #pragma mark Termination
 
 - (BOOL)isTerminating
 {
-    return f_appExit;
+    return b_intf_terminating;
 }
 
 - (void)applicationWillTerminate:(NSNotification *)notification
 {
-    bool isTerminating;
-
-    [o_appLock lock];
-    isTerminating = f_appExit;
-    f_appExit = true;
-    [o_appLock unlock];
-
-    if (isTerminating)
+    if (b_intf_terminating)
         return;
+    b_intf_terminating = true;
 
     [self resumeItunesPlayback:nil];
 



More information about the vlc-commits mailing list