adium-1.4 3626:f451e4eb43ee: Can't throw a brick without finding...
commits at adium.im
commits at adium.im
Tue Aug 23 02:12:01 UTC 2011
details: http://hg.adium.im/adium-1.4/rev/f451e4eb43ee
revision: 3626:f451e4eb43ee
branch: (none)
author: Evan Schoenberg
date: Mon Aug 22 21:09:06 2011 -0500
Can't throw a brick without finding a leak around here...
(transplanted from a65e456a1f4cb0fc336d46805708d672a4ca6dad)
Subject: adium-1.4 3627:6431098c625a: * Don't have -[AIChat containedObjects] return copy/autoreleased array. It confuses my memory management tracking and is unnecessarily inefficient when the most common use case uses it without mutation of the chat.
details: http://hg.adium.im/adium-1.4/rev/6431098c625a
revision: 3627:6431098c625a
branch: (none)
author: Evan Schoenberg
date: Mon Aug 22 21:11:40 2011 -0500
* Don't have -[AIChat containedObjects] return copy/autoreleased array. It confuses my memory management tracking and is unnecessarily inefficient when the most common use case uses it without mutation of the chat.
* Fix a logic error I introduced in a previous commit in -[AIChat removeAllParticipatingContactsSilently] and added a comment to avoid future confusion in the same way
* Change a copy/autorelease into copy/.../release, again to simplify memory management tracking
(transplanted from 6091a858e33c6d6c4788722117274dc5c2d3b956)
diffs (173 lines):
diff -r c079feb49178 -r 6431098c625a Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m Mon Aug 22 20:30:01 2011 -0500
+++ b/Frameworks/Adium Framework/Source/AIChat.m Mon Aug 22 21:11:40 2011 -0500
@@ -411,7 +411,7 @@
- (void)addParticipatingListObjects:(NSArray *)inObjects notify:(BOOL)notify
{
- NSMutableArray *contacts = [[inObjects mutableCopy] autorelease];
+ NSMutableArray *contacts = [inObjects mutableCopy];
for (AIListObject *obj in inObjects) {
if ([self containsObject:obj] || ![self canContainObject:obj])
@@ -420,6 +420,7 @@
[participatingContacts addObjectsFromArray:contacts];
[adium.chatController chat:self addedListContacts:contacts notify:notify];
+ [contacts release];
}
// Invite a list object to join the chat. Returns YES if the chat joins, NO otherwise
@@ -615,14 +616,13 @@
}
#pragma mark AIContainingObject protocol
-//AIContainingObject protocol
- (NSArray *)visibleContainedObjects
{
return self.containedObjects;
}
- (NSArray *)containedObjects
{
- return [[participatingContacts copy] autorelease];
+ return participatingContacts;
}
- (NSUInteger)countOfContainedObjects
{
@@ -696,18 +696,19 @@
- (void)removeAllParticipatingContactsSilently
{
- [participatingContacts removeAllObjects];
- [participatingContactsFlags removeAllObjects];
- [participatingContactsAliases removeAllObjects];
-
+ /* Note that allGroupChatsContainingContact won't count this chat if it's already marked as not open */
for (AIListContact *listContact in self) {
if (listContact.isStranger &&
![adium.chatController existingChatWithContact:listContact.parentContact] &&
- ![adium.chatController allGroupChatsContainingContact:listContact.parentContact].count) {
+ ([adium.chatController allGroupChatsContainingContact:listContact.parentContact].count == 0)) {
[adium.contactController accountDidStopTrackingContact:listContact];
}
}
+ [participatingContacts removeAllObjects];
+ [participatingContactsFlags removeAllObjects];
+ [participatingContactsAliases removeAllObjects];
+
[[NSNotificationCenter defaultCenter] postNotificationName:Chat_ParticipatingListObjectsChanged
object:self];
}
diff -r c079feb49178 -r 6431098c625a Frameworks/Adium Framework/Source/DCJoinChatWindowController.h
--- 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:11:40 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;
+ at property (nonatomic, retain) DCJoinChatViewController *joinChatViewController;
+
- (void)configureForAccount:(AIAccount *)inAccount;
- (IBAction)joinChat:(id)sender;
diff -r c079feb49178 -r 6431098c625a Frameworks/Adium Framework/Source/DCJoinChatWindowController.m
--- 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:11:40 2011 -0500
@@ -34,6 +34,8 @@
@implementation DCJoinChatWindowController
+ at 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
{
More information about the commits
mailing list