adium-1.4 3624:375d1588ba79: Nobody should be releasing proxy ob...

commits at adium.im commits at adium.im
Tue Aug 23 01:31:51 UTC 2011


details:	http://hg.adium.im/adium-1.4/rev/375d1588ba79
revision:	3624:375d1588ba79
branch:		(none)
author:		Evan Schoenberg
date:		Mon Aug 22 20:27:16 2011 -0500

Nobody should be releasing proxy objects externally; this should only be done when the AIListObject deallocates. Refs #14294
(transplanted from 7cedf16beeab402f04d3f58cb7926218b587a172)
Subject: adium-1.4 3625:c079feb49178: 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

details:	http://hg.adium.im/adium-1.4/rev/c079feb49178
revision:	3625:c079feb49178
branch:		(none)
author:		Evan Schoenberg
date:		Mon Aug 22 20:30:01 2011 -0500

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)

diffs (77 lines):

diff -r e9876704681e -r c079feb49178 Frameworks/Adium Framework/Source/AIListGroup.m
--- a/Frameworks/Adium Framework/Source/AIListGroup.m	Mon Aug 22 16:26:10 2011 +0200
+++ 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
diff -r e9876704681e -r c079feb49178 Frameworks/Adium Framework/Source/ESObjectWithProperties.h
--- a/Frameworks/Adium Framework/Source/ESObjectWithProperties.h	Mon Aug 22 16:26:10 2011 +0200
+++ b/Frameworks/Adium Framework/Source/ESObjectWithProperties.h	Mon Aug 22 20:30:01 2011 -0500
@@ -67,6 +67,5 @@
 
 - (NSSet *)proxyObjects;
 - (void)noteProxyObject:(id)proxyObject;
-- (void)clearProxyObjects;
 
 @end
diff -r e9876704681e -r c079feb49178 Frameworks/Adium Framework/Source/ESObjectWithProperties.m
--- a/Frameworks/Adium Framework/Source/ESObjectWithProperties.m	Mon Aug 22 16:26:10 2011 +0200
+++ b/Frameworks/Adium Framework/Source/ESObjectWithProperties.m	Mon Aug 22 20:30:01 2011 -0500
@@ -45,7 +45,7 @@
 	return self;
 }
 
-- (void)clearProxyObjects
+- (void)_clearProxyObjects
 {
 	for (AIProxyListObject *proxy in proxyObjects)
 		[AIProxyListObject releaseProxyObject:proxy];
@@ -57,7 +57,7 @@
  */
 - (void)dealloc
 {
-	[self clearProxyObjects];
+	[self _clearProxyObjects];
 
 	[propertiesDictionary release]; propertiesDictionary = nil;
 	[changedProperties release]; changedProperties = nil;
diff -r e9876704681e -r c079feb49178 Source/AIContactController.m
--- a/Source/AIContactController.m	Mon Aug 22 16:26:10 2011 +0200
+++ b/Source/AIContactController.m	Mon Aug 22 20:30:01 2011 -0500
@@ -1249,8 +1249,6 @@
 		[container removeObjectAfterAccountStopsTracking:inContact];
 	}
 
-	[inContact clearProxyObjects];
-
 	[contactDict removeObjectForKey:inContact.internalUniqueObjectID];
 }
 




More information about the commits mailing list