Commits

Peter Hosey  committed cd1d446

Notification-display bridges own their window controllers, so having each window controller to retain its bridge (as introduced in [325018a38208]) leaks both. Fixing this.

This introduces a crash, previously masked by the leak.

  • Participants
  • Parent commits ce8b07d
  • Branches default

Comments (0)

Files changed (1)

File Plugins/Displays/GrowlDisplayWindowController.m

 	NSFreeMapTable(startTimes);
 	NSFreeMapTable(endTimes);
 
-	[bridge				 release];
 	[target              release];
 	[clickContext        release];
 	[clickHandlerEnabled release];
 			NSLog(@"*** This may be an error. %@ had its bridge reset", self);
 			[bridge removeObserver:self forKeyPath:@"notification"];
 		}
-		
-		bridge = [theBridge retain];
-		
+
+		//Do not retain! The bridge owns us; retaining the bridge here is a mutual retention—i.e., a leak.
+		bridge = theBridge;
+
 		[bridge addObserver:self forKeyPath:@"notification" options:NSKeyValueObservingOptionNew context:NULL];
 		[self observeValueForKeyPath:@"notification" ofObject:bridge change:nil context:NULL];
 	}