Fixed the last retain-loop I found for AIChat; AIChat once more deallocates properly. Also, fixed behavior of removeAllParticipatingContactsSilently to work even if the chat isn't closing (though when we use it, it currently is... this is just less fragile).
authorEvan Schoenberg
Sun, 21 Aug 2011 16:15:48 -0500
changeset 3613 4d7607e78f81
parent 3612 b01904677149
child 3614 062a27e5858b
Fixed the last retain-loop I found for AIChat; AIChat once more deallocates properly. Also, fixed behavior of removeAllParticipatingContactsSilently to work even if the chat isn't closing (though when we use it, it currently is... this is just less fragile).
(transplanted from 80d30fd0e0d8ea348312ae9da11f0579a4ff0537)
Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m	Sun Aug 21 15:53:56 2011 -0500
+++ b/Frameworks/Adium Framework/Source/AIChat.m	Sun Aug 21 16:15:48 2011 -0500
@@ -282,7 +282,7 @@
 - (void)setDisplayName:(NSString *)inDisplayName
 {
 	[[self displayArrayForKey:@"Display Name"] setObject:inDisplayName
-											   withOwner:self
+											   withOwner:[NSValue valueWithNonretainedObject:self] /* Don't want a retain loop */
 										   priorityLevel:Highest_Priority];
 
 	//The display array doesn't cause an attribute update; fake it.
@@ -696,6 +696,10 @@
 
 - (void)removeAllParticipatingContactsSilently
 {
+    [participatingContacts removeAllObjects];
+	[participatingContactsFlags removeAllObjects];
+	[participatingContactsAliases removeAllObjects];
+
 	for (AIListContact *listContact in self) {
 		if (listContact.isStranger &&
 			![adium.chatController existingChatWithContact:listContact.parentContact] &&
@@ -704,10 +708,6 @@
 		}
 	}
 
-	[participatingContacts removeAllObjects];
-	[participatingContactsFlags removeAllObjects];
-	[participatingContactsAliases removeAllObjects];
-
 	[[NSNotificationCenter defaultCenter] postNotificationName:Chat_ParticipatingListObjectsChanged
 											  object:self];
 }