[vlc-commits] macosx: replace remaining synchronize calls on NSUserDefaults

Felix Paul Kühne git at videolan.org
Tue Jun 11 12:24:59 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Jun 11 12:23:10 2019 +0200| [69f8e5da874389360d461cece17a60747012cf32] | committer: Felix Paul Kühne

macosx: replace remaining synchronize calls on NSUserDefaults

In these specific spots, we need to force the write-to-disk so use a non-deprecated call.

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

 modules/gui/macosx/main/VLCMain+OldPrefs.m | 6 +++---
 modules/gui/macosx/main/VLCMain.m          | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/main/VLCMain+OldPrefs.m b/modules/gui/macosx/main/VLCMain+OldPrefs.m
index 356839993a..6860b254a6 100644
--- a/modules/gui/macosx/main/VLCMain+OldPrefs.m
+++ b/modules/gui/macosx/main/VLCMain+OldPrefs.m
@@ -54,7 +54,7 @@ static const int kCurrentPreferencesVersion = 4;
 
     // set correct version to avoid question about outdated config
     [standardUserDefaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
-    [standardUserDefaults synchronize];
+    CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
 }
 
 - (void)migrateOldPreferences
@@ -78,7 +78,7 @@ static const int kCurrentPreferencesVersion = 4;
 
     if (version == 1) {
         [defaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
-        [defaults synchronize];
+        CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
 
         if (!fixIntfSettings())
             return;
@@ -93,7 +93,7 @@ static const int kCurrentPreferencesVersion = 4;
         /* version 4 (introduced in 3.0.0) adds RTL settings depending on stored language */
         [defaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
         [VLCSimplePrefsController updateRightToLeftSettings];
-        [defaults synchronize];
+        CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
 
         // In VLC 2.2.x, config for filters was fully controlled by audio and video effects panel.
         // In VLC 3.0, this is no longer the case and VLCs config is not touched anymore. Therefore,
diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m
index ce1d839691..93917c8cdb 100644
--- a/modules/gui/macosx/main/VLCMain.m
+++ b/modules/gui/macosx/main/VLCMain.m
@@ -329,7 +329,7 @@ static VLCMain *sharedInstance = nil;
     _voutProvider = nil;
 
     /* write cached user defaults to disk */
-    [[NSUserDefaults standardUserDefaults] synchronize];
+    CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
 }
 
 #pragma mark -



More information about the vlc-commits mailing list