adium 4178:6091a858e33c: * Don't have -[AIChat containedObjects]...
commits at adium.im
commits at adium.im
Tue Aug 23 02:11:45 UTC 2011
details: http://hg.adium.im/adium/rev/6091a858e33c
revision: 4178:6091a858e33c
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
diffs (61 lines):
diff -r a65e456a1f4c -r 6091a858e33c Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m Mon Aug 22 21:09:06 2011 -0500
+++ b/Frameworks/Adium Framework/Source/AIChat.m Mon Aug 22 21:11:40 2011 -0500
@@ -429,7 +429,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])
@@ -438,6 +438,7 @@
[participatingContacts addObjectsFromArray:contacts];
[adium.chatController chat:self addedListContacts:contacts notify:notify];
+ [contacts release];
}
- (BOOL)addObject:(AIListObject *)inObject
@@ -643,14 +644,13 @@
}
#pragma mark AIContainingObject protocol
-//AIContainingObject protocol
- (NSArray *)visibleContainedObjects
{
return self.containedObjects;
}
- (NSArray *)containedObjects
{
- return [[participatingContacts copy] autorelease];
+ return participatingContacts;
}
- (NSUInteger)countOfContainedObjects
{
@@ -724,18 +724,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];
}
More information about the commits
mailing list