Re: CFPreferences and init.
Re: CFPreferences and init.
- Subject: Re: CFPreferences and init.
- From: "Adam R. Maxwell" <email@hidden>
- Date: Sun, 26 Oct 2008 16:39:30 -0700
On Oct 26, 2008, at 2:47 PM, Kyle Sluder wrote:
And I've already noticed a memory management error in my own code;
-setServers: leaks the old array. The first lines of the -setServers:
method should look like this:
-(void)setServers:(NSArray *)newServers
{
NSArray *oldServers = servers;
servers = [[newServers copy] retain];
[oldServers release];
// ... the rest of the method ...
}
This still leaks, since you copy the parameter and then retain the
copy. To the OP: I'd suggest that you choose one of the standard
Cocoa accessor patterns from the documentation and stick with it.
http://developer.apple.com/documentation/Cocoa/Conceptual/ModelObjects/Articles/moAccessorMethods.html#//apple_ref/doc/uid/TP40002132
http://www.stepwise.com/Articles/Technical/2002-06-11.01.html
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden