adium 2834:ed6cdbf42c2c: Avoid the crash without fixing the prob...

commits at adium.im commits at adium.im
Sat Oct 31 18:53:20 UTC 2009


details:	http://hg.adium.im/adium/rev/ed6cdbf42c2c
revision:	2834:ed6cdbf42c2c
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 31 14:49:13 2009 -0400

Avoid the crash without fixing the problem. Refs #13172.

This is being caused by the AdiumApplescriptRunner telling GBApplescriptFiltersPlugin that an applescript finished too many times.

AdiumApplescriptRunner is being told by the ApplescriptRunner that it's finishing too many times. When it occurs before the dict removal, it ends up telling the filter it finished too many times; this is still race-conditiony broken, so this is just a hacky bandaid until I can sort out why it's happening.

I'm not sure why the ApplescriptRunner is doing so.

diffs (35 lines):

diff -r f1b225d54546 -r ed6cdbf42c2c Source/AdiumApplescriptRunner.m
--- a/Source/AdiumApplescriptRunner.m	Sat Oct 31 13:40:47 2009 -0500
+++ b/Source/AdiumApplescriptRunner.m	Sat Oct 31 14:49:13 2009 -0400
@@ -149,6 +149,17 @@
 
 	NSDictionary *targetDict = [runningApplescriptsDict objectForKey:uniqueID];
 	if (targetDict) {
+		// Prevent a secondary "finish" from returning in the middle of the invocation.
+		[targetDict retain];
+		
+		//No further need for this dictionary entry
+		[runningApplescriptsDict removeObjectForKey:uniqueID];
+		
+		//If there's no others, release the dictionary.
+		if (![runningApplescriptsDict count]) {
+			[runningApplescriptsDict release]; runningApplescriptsDict = nil;
+		}
+		
 		id			 target = [targetDict objectForKey:@"target"];
 		//Selector will be of the form applescriptDidRun:resultString:
 		SEL			 selector = NSSelectorFromString([targetDict objectForKey:@"selector"]);
@@ -158,12 +169,7 @@
 					 withObject:[targetDict objectForKey:@"userInfo"]
 					 withObject:[userInfo objectForKey:@"resultString"]];
 		
-		//No further need for this dictionary entry
-		[runningApplescriptsDict removeObjectForKey:uniqueID];
-		
-		if (![runningApplescriptsDict count]) {
-			[runningApplescriptsDict release]; runningApplescriptsDict = nil;
-		}
+		[targetDict release];
 	}
 	[pool release];
 }




More information about the commits mailing list