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,36 +413,41 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 = [[NDHotKeyEvent alloc]
|
playHotKey = nil;
|
||||||
initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]
|
playHotKey = [[NDHotKeyEvent alloc]
|
||||||
modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]
|
initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]
|
||||||
];
|
modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue]
|
||||||
|
];
|
||||||
[playHotKey setTarget:self selector:@selector(clickPlay)];
|
[playHotKey setTarget:self selector:@selector(clickPlay)];
|
||||||
[playHotKey setEnabled:YES];
|
[playHotKey setEnabled:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousModifiers"] intValue]) {
|
||||||
prevHotKey = [[NDHotKeyEvent alloc]
|
prevHotKey = nil;
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
prevHotKey = [[NDHotKeyEvent alloc]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"]
|
||||||
];
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"]
|
||||||
|
];
|
||||||
[prevHotKey setTarget:self selector:@selector(clickPrev)];
|
[prevHotKey setTarget:self selector:@selector(clickPrev)];
|
||||||
[prevHotKey setEnabled:YES];
|
[prevHotKey setEnabled:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextModifiers"] intValue]) {
|
if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextModifiers"] intValue]) {
|
||||||
nextHotKey = [[NDHotKeyEvent alloc]
|
nextHotKey = nil;
|
||||||
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"]
|
nextHotKey = [[NDHotKeyEvent alloc]
|
||||||
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"]
|
initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"]
|
||||||
];
|
modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"]
|
||||||
|
];
|
||||||
[nextHotKey setTarget:self selector:@selector(clickNext)];
|
[nextHotKey setTarget:self selector:@selector(clickNext)];
|
||||||
[nextHotKey setEnabled:YES];
|
[nextHotKey setEnabled:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
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