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.
NSUserDefaultsController *defaults = [NSUserDefaultsController sharedUserDefaultsController];
self.recorderControl.delegate = self;
[self.recorderControl bind:NSValueBinding
toObject:defaults
withKeyPath:@"values.globalPing"
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
action:@selector(ping:)];
[hotKeyCenter registerHotKey:newHotKey];
}
}
else
[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
{
ApplicationDelegate *delegate = (ApplicationDelegate *)[[NSApplication sharedApplication] delegate];
@ -148,6 +164,10 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:CLCustomLabelChangedNotification object:nil];
[[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKeyPath:@"values.globalPing"];
}

Loading…
Cancel
Save