Burninate use of KVO by GrowlDisplayWindowController to observe its bridge's notification.
authorPeter Hosey <hg@boredzo.org>
Mon May 24 04:22:17 2010 -0700 (2010-05-24)
changeset 4621507967d00c44
parent 4620 cd1d446f791b
child 4622 693159a5f0e8
Burninate use of KVO by GrowlDisplayWindowController to observe its bridge's notification.

This is totally unnecessary and causes memory-management problems. Fixes the crash introduced by the leak fix (previous change).
Plugins/Displays/GrowlDisplayWindowController.m
     1.1 --- a/Plugins/Displays/GrowlDisplayWindowController.m	Mon May 24 04:14:10 2010 -0700
     1.2 +++ b/Plugins/Displays/GrowlDisplayWindowController.m	Mon May 24 04:22:17 2010 -0700
     1.3 @@ -108,7 +108,6 @@
     1.4  
     1.5  - (void) dealloc {
     1.6  	[self setDelegate:nil];
     1.7 -	[[self bridge] removeObserver:self forKeyPath:@"notification"];
     1.8  	[[NSNotificationCenter defaultCenter] removeObserver:self];
     1.9  	[self stopAllTransitions];
    1.10  
    1.11 @@ -557,23 +556,11 @@
    1.12  	if (bridge != theBridge) {
    1.13  		if (bridge) {
    1.14  			NSLog(@"*** This may be an error. %@ had its bridge reset", self);
    1.15 -			[bridge removeObserver:self forKeyPath:@"notification"];
    1.16  		}
    1.17  
    1.18  		//Do not retain! The bridge owns us; retaining the bridge here is a mutual retention—i.e., a leak.
    1.19  		bridge = theBridge;
    1.20  
    1.21 -		[bridge addObserver:self forKeyPath:@"notification" options:NSKeyValueObservingOptionNew context:NULL];
    1.22 -		[self observeValueForKeyPath:@"notification" ofObject:bridge change:nil context:NULL];
    1.23 -	}
    1.24 -}
    1.25 -
    1.26 -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
    1.27 -{
    1.28 -#pragma unused(change)
    1.29 -#pragma unused(context)
    1.30 -	if ((object == bridge) &&
    1.31 -		[keyPath isEqualToString:@"notification"]) {
    1.32  		[self setNotification:[bridge notification]];
    1.33  	}
    1.34  }