adium-1.4 2641:18edcaf334d1: Fix moving tabs around causing cras...
commits at adium.im
commits at adium.im
Sat Oct 24 20:47:37 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/18edcaf334d1
revision: 2641:18edcaf334d1
author: Zachary West <zacw at adium.im>
date: Sat Oct 24 16:47:32 2009 -0400
Fix moving tabs around causing crashes or behaving badly while "save open chats" is enabled. Fixes #12212.
This was caused by an error on my part when saved chats was added. We use uniqueContainerNumber to create unique containers, but we also restore these numerical values. When PSM says "hey, I need a new tab" we say "Sure! here, have this one" and give it an old tab.
This causes PSM to perform a wacky (in this situation) set of operations:
1) Add tab cell to new window.
2) Remove tab cell from old window. (triggers unbinding)
3) Set up bindings in new window.
However, the "add then remove" action causes it to be under-retained, lost, and confused. When a binding is generated, it's sent to a deallocated process (after the "remove"). When the new window and old window are not the same windows, however, PSM's actions are correct and proper.
The solution now is to not care what the created name of a chat is so saving is okay, but when we're creating a new window, we make sure it's new.
diffs (29 lines):
diff -r 99c3fd885fe4 -r 18edcaf334d1 Plugins/Dual Window Interface/AIDualWindowInterfacePlugin.m
--- a/Plugins/Dual Window Interface/AIDualWindowInterfacePlugin.m Sat Oct 24 14:38:12 2009 -0400
+++ b/Plugins/Dual Window Interface/AIDualWindowInterfacePlugin.m Sat Oct 24 16:47:32 2009 -0400
@@ -257,8 +257,11 @@
//Open a new container
- (AIMessageWindowController *)openContainerWithID:(NSString *)containerID name:(NSString *)containerName
{
- if (!containerID)
- containerID = [NSString stringWithFormat:@"%@:%ld", ADIUM_UNIQUE_CONTAINER, (long)uniqueContainerNumber++];
+ if (!containerID) {
+ while (!containerID || [containers objectForKey:containerID]) {
+ containerID = [NSString stringWithFormat:@"%@:%ld", ADIUM_UNIQUE_CONTAINER, (long)uniqueContainerNumber++];
+ }
+ }
AIMessageWindowController *windowController = [containers objectForKey:containerID];
if (!windowController) {
@@ -359,9 +362,8 @@
}
- (id)openNewContainer
-{
- AIMessageWindowController *controller = [self openContainerWithID:[NSString stringWithFormat:@"%@:%ld", ADIUM_UNIQUE_CONTAINER, (long)uniqueContainerNumber++]
- name:nil];
+{
+ AIMessageWindowController *controller = [self openContainerWithID:nil name:nil];
return controller;
}
More information about the commits
mailing list