Browse Source

Deallocation bug fix.

v1.2.4
Abhishek Banthia 9 years ago
parent
commit
b01d7c25a0
  1. 24
      Clocker/Preferences/CLPreferencesViewController.m

24
Clocker/Preferences/CLPreferencesViewController.m

@ -91,13 +91,17 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
// Do view setup here. // Do view setup here.
NSUserDefaultsController *defaults = [NSUserDefaultsController sharedUserDefaultsController]; NSUserDefaultsController *defaults = [NSUserDefaultsController sharedUserDefaultsController];
self.recorderControl.delegate = self;
[self.recorderControl bind:NSValueBinding [self.recorderControl bind:NSValueBinding
toObject:defaults toObject:defaults
withKeyPath:@"values.globalPing" withKeyPath:@"values.globalPing"
options:nil]; options:nil];
self.recorderControl.delegate = self;
[defaults addObserver:self forKeyPath:@"values.globalPing" options:NSKeyValueObservingOptionInitial context:NULL]; [defaults addObserver:self
forKeyPath:@"values.globalPing"
options:NSKeyValueObservingOptionInitial
context:NULL];
} }
/* /*
@ -132,12 +136,24 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
target:self target:self
action:@selector(ping:)]; action:@selector(ping:)];
[hotKeyCenter registerHotKey:newHotKey]; [hotKeyCenter registerHotKey:newHotKey];
} }
} }
else else
[super observeValueForKeyPath:aKeyPath ofObject:anObject change:aChange context:aContext]; [super observeValueForKeyPath:aKeyPath ofObject:anObject change:aChange context:aContext];
} }
- (BOOL)shortcutRecorderShouldBeginRecording:(SRRecorderControl *)aRecorder
{
[[PTHotKeyCenter sharedCenter] pause];
return YES;
}
- (void)shortcutRecorderDidEndRecording:(SRRecorderControl *)aRecorder
{
[[PTHotKeyCenter sharedCenter] resume];
}
-(IBAction)ping:(id)sender -(IBAction)ping:(id)sender
{ {
ApplicationDelegate *delegate = (ApplicationDelegate *)[[NSApplication sharedApplication] delegate]; ApplicationDelegate *delegate = (ApplicationDelegate *)[[NSApplication sharedApplication] delegate];
@ -148,6 +164,10 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
{ {
[[NSNotificationCenter defaultCenter] removeObserver:self [[NSNotificationCenter defaultCenter] removeObserver:self
name:CLCustomLabelChangedNotification object:nil]; name:CLCustomLabelChangedNotification object:nil];
[[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKeyPath:@"values.globalPing"];
} }

Loading…
Cancel
Save