Provide some retain/release protection around the property notifications when removing objects from groups. This probably has no real effect because the calls to it already have retain/autorelease, but it makes me feel better and is safer. Refs #14294
authorEvan Schoenberg
Mon, 22 Aug 2011 20:30:01 -0500
changeset 3625 c079feb49178
parent 3624 375d1588ba79
child 3626 f451e4eb43ee
Provide some retain/release protection around the property notifications when removing objects from groups. This probably has no real effect because the calls to it already have retain/autorelease, but it makes me feel better and is safer. Refs #14294
(transplanted from 367cb0b6d877d28ebb07641b44f041a90e36f435)
Frameworks/Adium Framework/Source/AIListGroup.m
--- a/Frameworks/Adium Framework/Source/AIListGroup.m	Mon Aug 22 20:27:16 2011 -0500
+++ b/Frameworks/Adium Framework/Source/AIListGroup.m	Mon Aug 22 20:30:01 2011 -0500
@@ -285,6 +285,8 @@
 	if ([self containsObject:inObject]) {		
 		AIListContact *contact = (AIListContact *)inObject;
 		//Remove the object
+        
+        [contact retain];
 		if ([_visibleObjects containsObject:contact])
 			[_visibleObjects removeObject:contact];
 		if ([contact.groups containsObject:self])
@@ -293,17 +295,21 @@
 		
 
 		[self didModifyProperties:[NSSet setWithObjects:@"VisibleObjectCount", @"ObjectCount", nil] silent:NO];
+        [contact release];
 	}
 }
 
 - (void)removeObjectAfterAccountStopsTracking:(AIListObject *)inObject
 {
 	NSParameterAssert([self canContainObject:inObject]);
+
+    [inObject retain];
 	if ([_visibleObjects containsObject:inObject])
 		[_visibleObjects removeObject:inObject];
 	[(AIListContact *)inObject removeContainingGroup:self];
 	[_containedObjects removeObject:inObject];
 	[self didModifyProperties:[NSSet setWithObjects:@"VisibleObjectCount", @"ObjectCount", nil] silent:NO];	
+    [inObject release];
 }
 
 #pragma mark Sorting