DKJ wrote:

Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak.

I'm assuming that the object wouldn't be re-instantiated without its previous instantiation being released. But I'd sleep better having an expert opinion.

Work it through. If you understand ownership, you already have all the expertise needed.

Can awakeFromNib be called more than once on the same instance? If so, then in awakeFromNib you need to account for the possibility of shadingAreas already holding a non-nil (hence, an owned) NSDictionary instance. The reason is simple: you own that non-nil instance.

What should you do if you discover a non-nil shadingAreas in awakeFromNib? It depends on you and your design. You could use the existing instance, if that makes sense. You could release the existing instance and alloc/init a new one, if that makes sense. You could trigger an assertion that fails if this happens, it that makes sense.

None of this has any bearing on what you'd do with shadingAreas in dealloc. You have to consider ownership in each method separately.

  -- GG
_______________________________________________

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