diff options
| author | Vadim Shpakovski | 2012-09-19 13:16:23 +0300 |
|---|---|---|
| committer | Vadim Shpakovski | 2012-09-19 13:16:23 +0300 |
| commit | cbc369c71a79f613ffbc3dbad91086f047d3c221 (patch) | |
| tree | b02e8d839ba1183aa6d06657e77f5a3e829e033b /MASShortcut+Monitoring.m | |
| parent | 4099b62587959708bd02d1c49ec1c8fa39448cf4 (diff) | |
| download | MASShortcut-cbc369c71a79f613ffbc3dbad91086f047d3c221.tar.bz2 | |
Removes ARC to support 32-bit.
Diffstat (limited to 'MASShortcut+Monitoring.m')
| -rw-r--r-- | MASShortcut+Monitoring.m | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/MASShortcut+Monitoring.m b/MASShortcut+Monitoring.m index 1460f6b..51787c2 100644 --- a/MASShortcut+Monitoring.m +++ b/MASShortcut+Monitoring.m @@ -25,7 +25,7 @@ void InstallHotkeyWithShortcut(MASShortcut *shortcut, UInt32 *outCarbonHotKeyID, + (id)addGlobalHotkeyMonitorWithShortcut:(MASShortcut *)shortcut handler:(void (^)())handler { NSString *monitor = [NSString stringWithFormat:@"%p: %@", shortcut, shortcut.description]; - MASShortcutHotKey *hotKey = [[MASShortcutHotKey alloc] initWithShortcut:shortcut handler:handler]; + MASShortcutHotKey *hotKey = [[[MASShortcutHotKey alloc] initWithShortcut:shortcut handler:handler] autorelease]; [MASRegisteredHotKeys() setObject:hotKey forKey:monitor]; return monitor; } @@ -57,7 +57,7 @@ void InstallHotkeyWithShortcut(MASShortcut *shortcut, UInt32 *outCarbonHotKeyID, { self = [super init]; if (self) { - _shortcut = shortcut; + _shortcut = [shortcut retain]; _handler = [handler copy]; InstallHotkeyWithShortcut(shortcut, &_carbonHotKeyID, &_carbonHotKey); } @@ -67,6 +67,7 @@ void InstallHotkeyWithShortcut(MASShortcut *shortcut, UInt32 *outCarbonHotKeyID, - (void)dealloc { [self uninstallExisitingHotKey]; + [super dealloc]; } - (void)uninstallExisitingHotKey @@ -86,7 +87,7 @@ NSMutableDictionary *MASRegisteredHotKeys() static NSMutableDictionary *shared = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - shared = [NSMutableDictionary dictionary]; + shared = [[NSMutableDictionary alloc] init]; }); return shared; } |
