On Dec 14, 2008, at 5:08 PM, Dimitri Bouniol wrote:
I'm at a loss when it comes to releasing CALayers.
Read and follow the memory management guidelines, CALayers follow them perfectly. <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html >
Since you can only create a layer with [CALayer layer] (docs advise not to use [[CALayer alloc] init])
The only advisory I'm aware of is against -initWithLayer: Could you point out where you saw the advisory against -init?
I would assume that the instance is automatically autoreleased.
Yes, a layer obtained via [CALayer layer] is not your responsibility to dispose of.
However, after looking through apple's sample code on a menu built with core animation, the layers were autoreleased in the dealloc method (this doesn't work too well if the layers aren't instance variables).
If you've found a bug with Apple Sample Code, then please file a bug report against that sample code.
Basically, here's my question: When (if ever) are you supposed to (auto)release CALayers?
If you follow the memory management rules, you will be fine. -- David Duncan Apple DTS Animation and Printing _______________________________________________ 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]
