adium 3544:2cafa270320d: This fixes crashes related to releasing...

commits at adium.im commits at adium.im
Tue Nov 16 16:35:00 UTC 2010


details:	http://hg.adium.im/adium/rev/2cafa270320d
revision:	3544:2cafa270320d
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Tue Nov 16 17:25:29 2010 +0100

This fixes crashes related to releasing properties on meta-contacts. It makes the hack twice as ugly, but without overhauling meta-contacts, I don't think there is a better way.

diffs (71 lines):

diff -r 7dbadd75e51f -r 2cafa270320d Frameworks/Adium Framework/Source/AIMetaContact.m
--- a/Frameworks/Adium Framework/Source/AIMetaContact.m	Tue Nov 16 12:42:45 2010 +0100
+++ b/Frameworks/Adium Framework/Source/AIMetaContact.m	Tue Nov 16 17:25:29 2010 +0100
@@ -51,6 +51,7 @@
 @property (readonly, nonatomic) NSArray *visibleListContacts;
 
 + (NSArray *)_forwardedProperties;
++ (NSArray *)_notForwardedProperties;
 @end
 
 @implementation AIMetaContact
@@ -687,7 +688,22 @@
 	if (properties == nil) {
 		properties = [[NSArray alloc] initWithObjects:@"isOnline", @"isEvent", @"isBlocked",
 					  @"isIdle", @"notAStranger", @"isMobile", @"signedOff", @"signedOn",
-					  @"alwaysOnline", @"unviewedContent", @"unviewedMention", nil];
+					  @"unviewedContent", @"unviewedMention", @"idle", @"idleSince", @"formattedUID",
+					  @"listObjectStatusMessage", @"textProfile", nil];
+	}
+	return properties;
+}
+
++ (NSArray *)_notForwardedProperties
+{
+	static NSArray *properties = nil;
+	
+	if (properties == nil) {
+		properties = [[NSArray alloc] initWithObjects:@"serverDisplayName", @"listStatusIcon",
+					  @"listStateIcon", @"imageOpacity", @"textColor", @"invertedTextColor",
+					  @"extendedStatus", @"labelColor", @"ABUniqueID", @"listObjectStatusType",
+					  @"listObjectStatusName", @"alwaysVisible", @"webKitUserIconPath",
+					  @"idleReadable", nil];
 	}
 	return properties;
 }
@@ -698,6 +714,8 @@
 	
 	if ([[[self class] _forwardedProperties] containsObject:key]) {
 		ret = [self.preferredContact valueForProperty:key];
+	} else if ([[[self class] _notForwardedProperties] containsObject:key]) {
+		ret = [super valueForProperty:key];
 	} else {
 		ret = [super valueForProperty:key] ?: [self.preferredContact valueForProperty:key];
 	}
@@ -711,6 +729,8 @@
 	
 	if ([[[self class] _forwardedProperties] containsObject:key]) {
 		ret = [self.preferredContact integerValueForProperty:key];
+	} else if ([[[self class] _notForwardedProperties] containsObject:key]) {
+		ret = [super integerValueForProperty:key];
 	} else {
 		ret = [super integerValueForProperty:key] ?: [self.preferredContact integerValueForProperty:key];
 	}
@@ -724,6 +744,8 @@
 	
 	if ([[[self class] _forwardedProperties] containsObject:key]) {
 		ret = [self.preferredContact intValueForProperty:key];
+	} else if ([[[self class] _notForwardedProperties] containsObject:key]) {
+		ret = [super intValueForProperty:key];
 	} else {
 		ret = [super intValueForProperty:key] ?: [self.preferredContact intValueForProperty:key];
 	}
@@ -737,6 +759,8 @@
 	
 	if ([[[self class] _forwardedProperties] containsObject:key]) {
 		ret = [self.preferredContact boolValueForProperty:key];
+	} else if ([[[self class] _notForwardedProperties] containsObject:key]) {
+		ret = [super boolValueForProperty:key];
 	} else {
 		ret = [super boolValueForProperty:key] ?: [self.preferredContact boolValueForProperty:key];
 	}




More information about the commits mailing list