[vlc-commits] macosx: remove most occurances of NSUserDefaults synchronize

Felix Paul Kühne git at videolan.org
Sat Jun 1 17:21:13 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Jun  1 15:42:11 2019 +0200| [f55b8f87e3d195dc2a375245a392e6e29f1299ea] | committer: Felix Paul Kühne

macosx: remove most occurances of NSUserDefaults synchronize

On the targetted macOS versions, this mainly a sleep timer on the main thread, which is not needed.

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

 modules/gui/macosx/os-integration/VLCDocumentController.m    |  1 -
 modules/gui/macosx/panels/VLCAudioEffectsWindowController.m  | 12 ------------
 modules/gui/macosx/panels/VLCVideoEffectsWindowController.m  |  9 ---------
 .../gui/macosx/playlist/VLCPlaybackContinuityController.m    |  1 -
 modules/gui/macosx/preferences/VLCSimplePrefsController.m    |  1 -
 .../convertandsave/VLCConvertAndSaveWindowController.m       |  1 -
 6 files changed, 25 deletions(-)

diff --git a/modules/gui/macosx/os-integration/VLCDocumentController.m b/modules/gui/macosx/os-integration/VLCDocumentController.m
index 9d71932a76..471a204b75 100644
--- a/modules/gui/macosx/os-integration/VLCDocumentController.m
+++ b/modules/gui/macosx/os-integration/VLCDocumentController.m
@@ -40,7 +40,6 @@
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     [defaults setObject:[NSDictionary dictionary] forKey:@"recentlyPlayedMedia"];
     [defaults setObject:[NSArray array] forKey:@"recentlyPlayedMediaList"];
-    [defaults synchronize];
 
     [super clearRecentDocuments:sender];
 }
diff --git a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
index 7606b12569..3dbe07e943 100644
--- a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
+++ b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
@@ -382,7 +382,6 @@
 
     [workArray replaceObjectAtIndex:currentProfileIndex withObject:newProfile];
     [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
-    [defaults synchronize];
 }
 
 - (void)saveCurrentProfileAtTerminate
@@ -470,8 +469,6 @@
     [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
 
     [self saveCurrentProfileIndex:([workArray count] - 1)];
-
-    [defaults synchronize];
 }
 
 - (IBAction)profileSelectorAction:(id)sender
@@ -535,11 +532,7 @@
 
         [_self saveCurrentProfileIndex:([workArray count] - 1)];
 
-
-        /* save defaults */
-        [defaults synchronize];
         [_self resetProfileSelector];
-
     }];
 }
 
@@ -576,8 +569,6 @@
         if (currentProfileIndex >= selectedIndex)
             [_self saveCurrentProfileIndex:(currentProfileIndex - 1)];
 
-        /* save defaults */
-        [defaults synchronize];
         [_self resetProfileSelector];
     }];
 }
@@ -819,7 +810,6 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
         workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
         [workArray addObject:decomposedStringWithCanonicalMapping];
         [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
-        [defaults synchronize];
 
         /* update VLC internals */
         char const *psz_eq_preset = [decomposedStringWithCanonicalMapping UTF8String];
@@ -862,7 +852,6 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
         workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
         [workArray removeObjectAtIndex:selectedIndex];
         [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
-        [defaults synchronize];
 
         /* update UI */
         [_self updatePresetSelector];
@@ -873,7 +862,6 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
 #pragma mark Compressor
 - (void)resetCompressor
 {
-    intf_thread_t *p_intf = getIntf();
     audio_output_t *p_aout = [_playerController mainAudioOutput];
     if (!p_aout)
         return;
diff --git a/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m b/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
index b4d3ef7d82..7dc676a47b 100644
--- a/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
+++ b/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
@@ -713,7 +713,6 @@
 
     [workArray replaceObjectAtIndex:currentProfileIndex withObject:newProfile];
     [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfiles"];
-    [defaults synchronize];
 }
 
 - (void)saveCurrentProfileAtTerminate
@@ -750,8 +749,6 @@
     [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfileNames"];
 
     [self saveCurrentProfileIndex:([workArray count] - 1)];
-
-    [defaults synchronize];
 }
 
 - (IBAction)toggleWindow:(id)sender
@@ -823,9 +820,6 @@
         [workArray addObject:resultingText];
         [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfileNames"];
 
-        /* save defaults */
-        [defaults synchronize];
-
         /* refresh UI */
         [_self resetProfileSelector];
     }];
@@ -868,9 +862,6 @@
         if (activeProfileIndex >= selectedIndex)
             [self saveCurrentProfileIndex:(activeProfileIndex - 1)];
 
-        /* save defaults */
-        [defaults synchronize];
-
         /* refresh UI */
         [_self resetProfileSelector];
     }];
diff --git a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
index 470dba6246..88b8a3bd0f 100644
--- a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
+++ b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
@@ -238,7 +238,6 @@
     }
     [defaults setObject:mutDict forKey:@"recentlyPlayedMedia"];
     [defaults setObject:mediaList forKey:@"recentlyPlayedMediaList"];
-    [defaults synchronize];
 }
 
 @end
diff --git a/modules/gui/macosx/preferences/VLCSimplePrefsController.m b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
index fa9584b885..c9d163476c 100644
--- a/modules/gui/macosx/preferences/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
@@ -964,7 +964,6 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
         [defaults setObject:toNSStr(language_map[index].iso) forKey:@"language"];
         [VLCSimplePrefsController updateRightToLeftSettings];
-        [defaults synchronize];
 
         config_PutInt("metadata-network-access", [_intf_artCheckbox state]);
 
diff --git a/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
index 8c409eafdc..1e27e23735 100644
--- a/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
+++ b/modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m
@@ -1055,7 +1055,6 @@
     NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
     [defaults setObject:_profileNames forKey:@"CASProfileNames"];
     [defaults setObject:_profileValueList forKey:@"CASProfiles"];
-    [defaults synchronize];
 }
 
 - (void)recreateProfilePopup



More information about the vlc-commits mailing list