Re: retain/release question about Apple docs
Re: retain/release question about Apple docs
- Subject: Re: retain/release question about Apple docs
- From: Julian Cain <email@hidden>
- Date: Mon, 6 Mar 2006 11:52:54 -0500
What is wrong with using a macro such as :
#define REPLACE(a, b) if (b != nil) {[b retain]; [a release]; a = b;}
This is what I always use for setters.
~Julian Cain
email@hidden
On Mar 6, 2006, at 4:32 AM, Volker Runkel wrote:
Hi James,
the string newValue has to be released since it was retained before
creating a copy to mString .
The usual procedure would be :
if (mString != newValue) {
// don't retain here [newValue retain];
if (mString) [mString release];
mString = [newValue copy];
// so don't release here [newValue release];
}
Volker
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden