adium 2432:d8892a29ba70: This could violate the fast enumeration...

commits at adium.im commits at adium.im
Sun May 31 19:53:40 UTC 2009


details:	http://hg.adium.im/adium/rev/d8892a29ba70
revision:	2432:d8892a29ba70
author:		David Smith <catfish.man at gmail.com>
date:		Sun May 31 12:53:35 2009 -0700

This could violate the fast enumeration rule in some situations. I really hate making copies in something that runs this often, but I can't think of another way to do it offhand.

diffs (12 lines):

diff -r e22f9d1f45a5 -r d8892a29ba70 Source/AIPreferenceController.m
--- a/Source/AIPreferenceController.m	Sun May 31 14:59:59 2009 -0400
+++ b/Source/AIPreferenceController.m	Sun May 31 12:53:35 2009 -0700
@@ -296,7 +296,7 @@
         [delayedNotificationGroups addObject:group];
     } else {
 		NSDictionary	*preferenceDict = [[[self preferenceContainerForGroup:group object:object] dictionary] retain];
-		for (NSValue *observerValue in [observers objectForKey:group]) {
+		for (NSValue *observerValue in [[[observers objectForKey:group] copy] autorelease]) {
 			id observer = observerValue.nonretainedObjectValue;
 			[observer preferencesChangedForGroup:group
 											 key:key




More information about the commits mailing list