Michael;

OK to really perhaps beat the poor horse,  is the following kosher?

 (NSDictionary *) prefDictionary {
return [(NSDictionary *)CFPreferencesCopyMultiple(NULL, appBundleID, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost) autorelease];
}

Steve


Michael said:
Yep, this fixes the leak. Your Copy is balanced with a Release and all is well.

However, just to be really nitpicky, I'll point out that it's a bit
ugly. You build a new dictionary from the old one, then throw the old
one away. Better to just keep the old one around with something like
this:

return [(id)prefs autorelease];

Or if you're in a garbage collected environment:

return NSMakeCollectable(prefs);

(And you can do both if you're writing dual-mode code.)

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to