Can't throw a brick without finding a leak around here...
authorEvan Schoenberg
Mon, 22 Aug 2011 21:09:06 -0500
changeset 3626 f451e4eb43ee
parent 3625 c079feb49178
child 3627 6431098c625a
Can't throw a brick without finding a leak around here...
(transplanted from a65e456a1f4cb0fc336d46805708d672a4ca6dad)
Frameworks/Adium Framework/Source/DCJoinChatWindowController.h
Frameworks/Adium Framework/Source/DCJoinChatWindowController.m
--- a/Frameworks/Adium Framework/Source/DCJoinChatWindowController.h	Mon Aug 22 20:30:01 2011 -0500
+++ b/Frameworks/Adium Framework/Source/DCJoinChatWindowController.h	Mon Aug 22 21:09:06 2011 -0500
@@ -27,8 +27,7 @@
 	IBOutlet		AILocalizationButton		*button_joinChat;
 	IBOutlet		AILocalizationButton		*button_cancel;
 
-	DCJoinChatViewController		*controller;				//Current view controller
-	NSView							*currentView;				//
+	DCJoinChatViewController		*joinChatViewController;				//Current view controller
 	
 	AIAccountMenu 					*accountMenu;
 	
@@ -37,7 +36,8 @@
 
 + (DCJoinChatWindowController *)showJoinChatWindow;
 
-- (DCJoinChatViewController*)joinChatViewController;
+@property (nonatomic, retain) DCJoinChatViewController *joinChatViewController;
+
 - (void)configureForAccount:(AIAccount *)inAccount;
 - (IBAction)joinChat:(id)sender;
 
--- a/Frameworks/Adium Framework/Source/DCJoinChatWindowController.m	Mon Aug 22 20:30:01 2011 -0500
+++ b/Frameworks/Adium Framework/Source/DCJoinChatWindowController.m	Mon Aug 22 21:09:06 2011 -0500
@@ -34,6 +34,8 @@
 
 @implementation DCJoinChatWindowController
 
+@synthesize joinChatViewController;
+
 static DCJoinChatWindowController *sharedJoinChatInstance = nil;
 
 //Create a new join chat window
@@ -54,17 +56,11 @@
     }
 }
 
-- (DCJoinChatViewController*)joinChatViewController
-{ 
-    return controller; 
-
-} 
-
 - (IBAction)joinChat:(id)sender
 {
 	// If there is a controller, it handles all of the join-chat work
-	if ( controller ) {
-		[controller joinChatWithAccount:[[popUp_service selectedItem] representedObject]];
+	if (self.joinChatViewController) {
+		[self.joinChatViewController joinChatWithAccount:[[popUp_service selectedItem] representedObject]];
 	}
 	
 	[self closeWindow:nil];
@@ -76,14 +72,13 @@
 	int		diff;
 
 	//Remove the previous view controller's view
-	[currentView removeFromSuperview];
-	[currentView release]; currentView = nil;
+	[[self.joinChatViewController view] removeFromSuperview];
 
 	//Get a view controller for this account if there is one
-	controller = [[inAccount.service joinChatView] retain];
-	currentView = [controller view];
-	[controller setDelegate:self];
-	[controller setSharedChatInstance:self];
+	self.joinChatViewController = [inAccount.service joinChatView];
+	NSView *currentView = [self.joinChatViewController view];
+	[self.joinChatViewController setDelegate:self];
+	[self.joinChatViewController setSharedChatInstance:self];
 
 	//Resize the window to fit the new view
 	diff = NSHeight([view_customView frame]) - NSHeight([currentView frame]);
@@ -95,9 +90,9 @@
 
 	[[self window] setFrame:windowFrame display:YES animate:YES];
 
-	if (controller && currentView) {
+	if (self.joinChatViewController && currentView) {
 		[view_customView addSubview:currentView];
-		[controller configureForAccount:inAccount];
+		[self.joinChatViewController configureForAccount:inAccount];
 	}
 
     [popUp_service selectItemWithRepresentedObject:inAccount];
@@ -111,15 +106,19 @@
 - (id)initWithWindowNibName:(NSString *)windowNibName
 {	
     [super initWithWindowNibName:windowNibName];    
-	    		
-	if ( controller )
-		[controller release];
-	
-	controller = nil;
+	    
+	self.joinChatViewController = nil;
 
     return self;
 }
 
+- (void)dealloc
+{
+	self.joinChatViewController = nil;
+	
+	[super dealloc];
+}
+
 //Setup the window before it is displayed
 - (void)windowDidLoad
 {