From a3385d1af9b48e6a05d93f07ad16d27aaaf95cce Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 7 Mar 2025 04:39:44 -0800 Subject: [PATCH] Crash Fix: Change how default shortcuts are stored It turns out that initializing NSUserDefaultsController like this is a really bad idea, especially on older versions of macOS. This is probably also why the equalizer was crashing for people on first activation. Signed-off-by: Christopher Snowhill --- Application/AppController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Application/AppController.m b/Application/AppController.m index 33cbb7636..277bfad82 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -709,7 +709,7 @@ MASShortcut *shortcutWithMigration(NSString *oldKeyCodePrefName, } } -static NSUserDefaultsController *shortcutDefaultsController = nil; +static NSDictionary *shortcutDefaults = nil; - (void)registerDefaultHotKeys { MASShortcut *playShortcut = shortcutWithMigration(@"hotKeyPlayKeyCode", @@ -752,11 +752,15 @@ static NSUserDefaultsController *shortcutDefaultsController = nil; CogSeekForwardShortcutKey: seekFwdShortcutData }; - shortcutDefaultsController = [[NSUserDefaultsController sharedUserDefaultsController] initWithDefaults:nil initialValues:defaultShortcuts]; + shortcutDefaults = defaultShortcuts; + + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultShortcuts]; } - (IBAction)resetHotkeys:(id)sender { - [shortcutDefaultsController revertToInitialValues:sender]; + [shortcutDefaults enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + [[NSUserDefaults standardUserDefaults] setObject:obj forKey:key]; + }]; } - (void)registerHotKeys {