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 <kode54@gmail.com>
This commit is contained in:
parent
9cc0b8be8d
commit
a3385d1af9
1 changed files with 7 additions and 3 deletions
|
@ -709,7 +709,7 @@ MASShortcut *shortcutWithMigration(NSString *oldKeyCodePrefName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSUserDefaultsController *shortcutDefaultsController = nil;
|
static NSDictionary *shortcutDefaults = nil;
|
||||||
|
|
||||||
- (void)registerDefaultHotKeys {
|
- (void)registerDefaultHotKeys {
|
||||||
MASShortcut *playShortcut = shortcutWithMigration(@"hotKeyPlayKeyCode",
|
MASShortcut *playShortcut = shortcutWithMigration(@"hotKeyPlayKeyCode",
|
||||||
|
@ -752,11 +752,15 @@ static NSUserDefaultsController *shortcutDefaultsController = nil;
|
||||||
CogSeekForwardShortcutKey: seekFwdShortcutData
|
CogSeekForwardShortcutKey: seekFwdShortcutData
|
||||||
};
|
};
|
||||||
|
|
||||||
shortcutDefaultsController = [[NSUserDefaultsController sharedUserDefaultsController] initWithDefaults:nil initialValues:defaultShortcuts];
|
shortcutDefaults = defaultShortcuts;
|
||||||
|
|
||||||
|
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultShortcuts];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)resetHotkeys:(id)sender {
|
- (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 {
|
- (void)registerHotKeys {
|
||||||
|
|
Loading…
Reference in a new issue