Thanks Ken.

I'll do 2.

-koko


On Jul 7, 2010, at 6:15 PM, Ken Thomases wrote:

On Jul 7, 2010, at 6:09 PM, k...@highrolls.net wrote:

Even though it would be better style would my approach cause any problem? I don't see any.

Yes. You alloc+init and you also retain. Then, you (presumably) only release once when the panel closes. Thus, you are leaking the window controller. If you're going to go with a self-owning window controller, then either:

1) You should not retain self and the release on close balances the alloc.

OR

2) The code which does the alloc should also release (balanced), and the window controller should both retain and release itself (balanced).

If you insist on going this route, I guess I recommend 2 since it makes it clearer that both pieces of code balance their own responsibilities. With 1, the responsibilities are split between two unrelated parts of the code.

Regards,
Ken



_______________________________________________

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