Re: Sanity Check
Re: Sanity Check
- Subject: Re: Sanity Check
- From: Ken Thomases <email@hidden>
- Date: Wed, 7 Jul 2010 19:15:52 -0500
On Jul 7, 2010, at 6:09 PM, email@hidden 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 (email@hidden)
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:
This email sent to email@hidden