aboutsummaryrefslogtreecommitdiffstats
path: root/MASShortcut+Monitoring.m
diff options
context:
space:
mode:
authorVadim Shpakovski2012-09-19 13:16:23 +0300
committerVadim Shpakovski2012-09-19 13:16:23 +0300
commitcbc369c71a79f613ffbc3dbad91086f047d3c221 (patch)
treeb02e8d839ba1183aa6d06657e77f5a3e829e033b /MASShortcut+Monitoring.m
parent4099b62587959708bd02d1c49ec1c8fa39448cf4 (diff)
downloadMASShortcut-cbc369c71a79f613ffbc3dbad91086f047d3c221.tar.bz2
Removes ARC to support 32-bit.
Diffstat (limited to 'MASShortcut+Monitoring.m')
-rw-r--r--MASShortcut+Monitoring.m7
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;
}