[vlc-devel] [PATCH] macosx: Remove VoutWindowController lock

Marvin Scholz epirat07 at gmail.com
Wed Aug 9 00:23:17 CEST 2017


The lock does not protect anything meaningful anymore and seems
useless.
---
 modules/gui/macosx/VLCMain.m                 | 2 --
 modules/gui/macosx/VLCVoutWindowController.h | 2 --
 modules/gui/macosx/VLCVoutWindowController.m | 8 --------
 3 files changed, 12 deletions(-)

diff --git a/modules/gui/macosx/VLCMain.m b/modules/gui/macosx/VLCMain.m
index 6b4a4d2a54..98167ae25a 100644
--- a/modules/gui/macosx/VLCMain.m
+++ b/modules/gui/macosx/VLCMain.m
@@ -350,10 +350,8 @@ - (void)applicationWillTerminate:(NSNotification *)notification
 
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
-    [_voutController.lock lock];
     // closes all open vouts
     _voutController = nil;
-    [_voutController.lock unlock];
 
     /* write cached user defaults to disk */
     [[NSUserDefaults standardUserDefaults] synchronize];
diff --git a/modules/gui/macosx/VLCVoutWindowController.h b/modules/gui/macosx/VLCVoutWindowController.h
index cd0fdd9469..8959e2860b 100644
--- a/modules/gui/macosx/VLCVoutWindowController.h
+++ b/modules/gui/macosx/VLCVoutWindowController.h
@@ -33,8 +33,6 @@
 
 @interface VLCVoutWindowController : NSObject
 
- at property (readonly, atomic) NSLock *lock;
-
 @property (readonly, nonatomic) NSInteger currentStatusWindowLevel;
 
 - (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 32fced7b89..9b086c8f60 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -63,7 +63,6 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
         if (!voutController) {
             return VLC_EGENERIC;
         }
-        [voutController.lock lock];
 
         __block VLCVoutView *videoView = nil;
 
@@ -78,8 +77,6 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
         msg_Dbg(getIntf(), "returning videoview with proposed position x=%i, y=%i, width=%i, height=%i", cfg->x, cfg->y, cfg->width, cfg->height);
         p_wnd->handle.nsobject = (void *)CFBridgingRetain(videoView);
 
-        [voutController.lock unlock];
-
         p_wnd->type = VOUT_WINDOW_TYPE_NSOBJECT;
         p_wnd->control = WindowControl;
     }
@@ -94,7 +91,6 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
         if (!voutController) {
             return VLC_EGENERIC;
         }
-        [voutController.lock lock];
 
         switch(i_query) {
             case VOUT_WINDOW_SET_STATE:
@@ -150,13 +146,11 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
             default:
             {
                 msg_Warn(p_wnd, "unsupported control query: %i", i_query );
-                [voutController.lock unlock];
                 return VLC_EGENERIC;
             }
         }
 
         out:
-        [voutController.lock unlock];
         return VLC_SUCCESS;
     }
 }
@@ -169,11 +163,9 @@ void WindowClose(vout_window_t *p_wnd)
             return;
         }
 
-        [voutController.lock lock];
         dispatch_async(dispatch_get_main_queue(), ^{
             [voutController removeVoutForDisplay:[NSValue valueWithPointer:p_wnd]];
         });
-        [voutController.lock unlock];
     }
 }
 
-- 
2.11.0 (Apple Git-81)



More information about the vlc-devel mailing list