On Apr 27, 2010, at 12:58 PM, vincent habchi wrote:

> Yet, at the same time, you may want the dealloc: method to trigger some 
> events. For example, if you have a CALayer that holds various sublayers, and 
> that CALayer goes away, you may want all the sublayers to go away at the same 
> time. Yet, this is impossible if some other object around locks a reference 
> to the sublayers.

So what's the problem? If other objects are holding references to the 
sublayers, then they should no* go away. On the other hand, if your really need 
them to go away when the parent layer goes away, then other objects should not 
hold references to the sublayers. The sublayers will go away when no references 
to them exist any longer; it is the parent layer's responsibility to release 
the references it holds on them; it is other objects' responsibility to release 
any references they hold; it is your responsibility to determine whether or not 
other objects should ever hold references to the sublayers--and of course to 
manage (retain/release/autorelease) the references that you need.

> By the way, how are exactly multiple calls to [object autorelease] handled by 
> the pool? Does this give rise to as many calls to release: as they are 
> autorelease references stored, or does the pool directly adjust the retain 
> count?

Why would you care?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

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