You must do both, otherwise you will leak.

Sent from my iPhone

On Oct 26, 2008, at 10:58, DKJ <[EMAIL PROTECTED]> wrote:

Thanks to everyone for the replies. I have one (hopefully last) question (on this topic):

On 26 Oct, 2008, at 09:23, Clark Cox wrote:
As long as MyCALayer's dealloc is properly implemented (to release
foregroundColor, or set it to nil), you should never need to
explicitly do so in code that uses MyCALayer.


If I do this in MyCALayer's dealloc:

   self.foregroundColor = nil;

do I need to do this in init:

   CGColorRef temp = CGColorCreateGenericRGB( etc. );
   self.foregroundColor = temp;
   CFRelease( temp );

or can I just do this:

   self.foregroundColor = CGColorCreateGenericRGB( etc. );

For the time being, I'll do both.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [EMAIL PROTECTED]

Reply via email to