Fix HotKey initialization to deinitialize any existing instances, as the global hash table is not reference counted, and the previous design would result in the hash table being set twice, then cleared.
parent
c2bf3225d1
commit
b5967bb2e1
|
@ -413,9 +413,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unassign previous handler first, so dealloc can unregister it from the global map before the new instances are assigned */
|
||||||
- (void)registerHotKeys
|
- (void)registerHotKeys
|
||||||
{
|
{
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]) {
|
||||||
|
playHotKey = nil;
|
||||||
playHotKey = [[NDHotKeyEvent alloc]
|
playHotKey = [[NDHotKeyEvent alloc]
|
||||||
initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]
|
initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]
|
||||||
modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]
|
modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]
|
||||||
|
@ -425,6 +427,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousModifiers"] intValue]) {
|
||||||
|
prevHotKey = nil;
|
||||||
prevHotKey = [[NDHotKeyEvent alloc]
|
prevHotKey = [[NDHotKeyEvent alloc]
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
||||||
|
@ -434,6 +437,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextModifiers"] intValue]) {
|
||||||
|
nextHotKey = nil;
|
||||||
nextHotKey = [[NDHotKeyEvent alloc]
|
nextHotKey = [[NDHotKeyEvent alloc]
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"]
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"]
|
||||||
|
@ -443,6 +447,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeySpamModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeySpamModifiers"] intValue]) {
|
||||||
|
spamHotKey = nil;
|
||||||
spamHotKey = [[NDHotKeyEvent alloc]
|
spamHotKey = [[NDHotKeyEvent alloc]
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamKeyCode"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamKeyCode"]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamModifiers"]
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamModifiers"]
|
||||||
|
|
Loading…
Reference in New Issue