adium 4155:a9560a8f30eb: Apply the same fix as a00b7964253b, but...

commits at adium.im commits at adium.im
Sun Aug 21 20:14:41 UTC 2011


details:	http://hg.adium.im/adium/rev/a9560a8f30eb
revision:	4155:a9560a8f30eb
branch:		(none)
author:		Evan Schoenberg
date:		Sun Aug 21 15:14:33 2011 -0500

Apply the same fix as a00b7964253b, but for group chats, again resolving a double-retain

diffs (34 lines):

diff -r 2f0d142e3995 -r a9560a8f30eb Plugins/Purple Service/SLPurpleCocoaAdapter.m
--- a/Plugins/Purple Service/SLPurpleCocoaAdapter.m	Sun Aug 21 15:06:27 2011 -0500
+++ b/Plugins/Purple Service/SLPurpleCocoaAdapter.m	Sun Aug 21 15:14:33 2011 -0500
@@ -412,12 +412,29 @@
 		NSString *name = [NSString stringWithUTF8String:purple_conversation_get_name(conv)];
 		
 		CBPurpleAccount *account = accountLookup(purple_conversation_get_account(conv));
+        
+        /* 
+         * Need to start a new chat, associating with the PurpleConversation.
+         *
+         * This may call back through to us recursively, via:
+         *   -[CBPurpleAccount chatWithContact:identifier:]
+         *   -[AIChatController chatWithContact:]
+         *   -[CBPurpleAccount openChat:]
+         *   -[SLPurpleCocoaAdaper openChat:onAccount:]
+         *   convLookupFromChat()
+         *   groupChatLookupFromConv()
+         *
+         * That's fine, as we'll get the same lookups the second time through; we just need to be cautious.
+         */
 		chat = [account chatWithName:name identifier:[NSValue valueWithPointer:conv]];
 		if (!chat.chatCreationDictionary) {
 			// If we don't have a chat creation dictionary (i.e., we didn't initiate the join), create one.
 			chat.chatCreationDictionary = [account extractChatCreationDictionaryFromConversation: conv];
 		}
-		conv->ui_data = [chat retain];
+        if (conv->ui_data != chat) {
+            [(AIChat *)(conv->ui_data) release];
+            conv->ui_data = [chat retain];
+        }
 		AILog(@"group chat lookup assigned %@ to %p (%s)",chat,conv, purple_conversation_get_name(conv));
 	}
 




More information about the commits mailing list