• 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: NSWindow Subclass close/dealloc question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow Subclass close/dealloc question


  • Subject: Re: NSWindow Subclass close/dealloc question
  • From: Dave <email@hidden>
  • Date: Thu, 02 Apr 2015 19:28:24 +0100

>
> No, then the window will be uncloseable.  What needs to be different depending on that property is whether you call -release, not whether you pass the -close call up to super.  If you're using ARC, you don't get to control whether you call release.  Therefore, you need to set releasedWhenClosed to NO.
>
> If you're experiencing leaks when releasedWhenClosed is false, then that's a separate bug in your code, which you need to fix.

No, I’m not using ARC.

releasedWhenClosed is YES.

I alloc/init the NSWindow subclass and store it in a retained property.

When I get the Close notification, I send a Close to the window, then  I set the property to nil to release it.

If I don’t call [super close] this all is well and it calls dealloc ok when I set he property to nil.

I’m not experiencing any leaks, this code was ported (imported in bits) from the pre ARC days (Mac OS X 10.4 I think) and I’m trying to make it work on Mac OS X 10.10.

Are you saying that dealloc calls close?

Since it’s being released straight after the close is sent, does this make the releasedWhenClosed setting a bit irrelevant anyway?

I don’t have a problem with setting releasedWhenClosed to NO, it’s just there was a comment on the code saying that it made a LOT of difference having to set to YES and I’m just trying to figure out it’s supposed to work with releasedWhenClosed == YES.

All the Best
Dave



_______________________________________________

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


References: 
 >NSWindow Subclass close/dealloc question (From: Dave <email@hidden>)
 >Re: NSWindow Subclass close/dealloc question (From: Ken Thomases <email@hidden>)
 >Re: NSWindow Subclass close/dealloc question (From: Dave <email@hidden>)
 >Re: NSWindow Subclass close/dealloc question (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSWindow Subclass close/dealloc question
  • Next by Date: Re: Swift: How to determine if a Character represents whitespace?
  • Previous by thread: Re: NSWindow Subclass close/dealloc question
  • Next by thread: Another NSWindow Question
  • Index(es):
    • Date
    • Thread