summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave DeLong2010-03-19 14:19:23 -0600
committerDave DeLong2010-03-19 14:19:23 -0600
commite439484a453b95e8400899678abe996020c9af37 (patch)
tree22648616c8f0bb8a9be08f1ad6b5e756f6f73d4d
parent3eb84979081c9651a6def70e4b59f4bd1c918cbc (diff)
downloadDDHotKey-e439484a453b95e8400899678abe996020c9af37.tar.bz2
Modified the unregister method, since relying on unregistration happening during -dealloc can cause some minor problems (including hotkeys not getting unregistered immediately)
-rw-r--r--DDHotKeyCenter.m7
1 files changed, 4 insertions, 3 deletions
diff --git a/DDHotKeyCenter.m b/DDHotKeyCenter.m
index dffdced..7fc4af4 100644
--- a/DDHotKeyCenter.m
+++ b/DDHotKeyCenter.m
@@ -181,12 +181,13 @@ NSUInteger dd_translateModifierFlags(NSUInteger flags);
}
- (void) unregisterHotKeysMatchingPredicate:(NSPredicate *)predicate {
- //when a DDHotKey is deallocated, it unregisters itself
- //-hotKeysMatchingPredicate returns an autoreleased set
- //so we force sooner deallocation (and unregistering) with a explicit pool
+ //explicitly unregister the hotkey, since relying on the unregistration in -dealloc can be problematic
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSSet * matches = [self hotKeysMatchingPredicate:predicate];
[_registeredHotKeys minusSet:matches];
+ for (DDHotKey * key in matches) {
+ [key unregisterHotKey];
+ }
[pool release];
}