adium 2977:bd2d13cea28d: Possibly correct a hang when dragging c...
commits at adium.im
commits at adium.im
Thu Nov 26 05:53:20 UTC 2009
details: http://hg.adium.im/adium/rev/bd2d13cea28d
revision: 2977:bd2d13cea28d
author: Zachary West <zacw at adium.im>
date: Thu Nov 26 00:53:04 2009 -0500
Possibly correct a hang when dragging contacts around. Refs #12233.
The only explanation I can see for infinite looping in this while() is that orderIndexforObject is INFINITY, so our constant incrementing is yielding more INFINITY, ad infinitum.
I've added an AILog so that if this is truly the case it'll show up in a debug log. I'd be interested to see if this guess is right, especially since I can't figure out why it would happen except for corrupt index caches.
(transplanted from 4a64255881c8b5c3e65187efb00b531ee3ac9384)
diffs (30 lines):
diff -r 161843c565aa -r bd2d13cea28d Frameworks/Adium Framework/Source/AIListObject.m
--- a/Frameworks/Adium Framework/Source/AIListObject.m Thu Nov 26 00:22:17 2009 -0500
+++ b/Frameworks/Adium Framework/Source/AIListObject.m Thu Nov 26 00:53:04 2009 -0500
@@ -665,6 +665,26 @@
NSDictionary *dict = [self preferenceForKey:@"OrderIndexDictionary"
group:ObjectStatusCache];
NSMutableDictionary *newDict = (dict ? [[dict mutableCopy] autorelease] : [NSMutableDictionary dictionary]);
+
+ // Sanity check - are we trying to assign infinity?
+ if (orderIndexForObject == INFINITY) {
+ AILogWithSignature(@"Correcting for INFINITY index, inObj=%@ allObj=%@", listObject, [dict objectForKey:[NSNumber numberWithFloat:INFINITY]]);
+
+ // Remove any objects that currently are currently set to INFINITY, they'll regenerate their position to the last place.
+ [newDict removeObjectForKey:[NSNumber numberWithFloat:INFINITY]];
+
+ // Update the preference.
+ [self setPreference:newDict
+ forKey:@"OrderIndexDictionary"
+ group:ObjectStatusCache];
+
+ // Update our largest cache.
+ [self updateOrderCache];
+
+ // Assume an index of largest+1
+ orderIndexForObject = self.largestOrder + 1;
+ }
+
NSNumber *orderIndexForObjectNumber = [NSNumber numberWithFloat:orderIndexForObject];
//Prevent setting an order index which we already have
More information about the commits
mailing list