• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sanity Check
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Sanity Check
      • From: email@hidden
References: 
 >Fwd: Sanity Check (From: email@hidden)
 >Re: Sanity Check (From: Chris Hanson <email@hidden>)
 >Re: Sanity Check (From: email@hidden)

  • Prev by Date: Re: Pass-by value… warning
  • Next by Date: Re: Programmatically highlighting an NSMenuItem
  • Previous by thread: Re: Sanity Check
  • Next by thread: Re: Sanity Check
  • Index(es):
    • Date
    • Thread