• 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: Lingering windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lingering windows


  • Subject: Re: Lingering windows
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 10 Aug 2011 09:02:51 +1000

On Aug 10, 2011, at 3:51 AM, Quincey Morris wrote:

> It's not entirely clear what it is you're expecting here.

What I'm expecting is that when I close a document, the document, the window controller and the window will disappear.
>
> AFAICT -- and I have spent some time pondering the documentation and APIs on this -- there really *isn't* anything that you could call "closing a window" other than the sequence you describe above. Again AFAICT, window closing and ordering-out are indistinguishable, for all practical purposes at least.

I only noticed the problem from the scripting interface. Let's say I have two documents open: the (pretty standard) scripting interface shows two documents and two windows. If I close the documents, it shows no documents but still two windows -- which I can make reappear by setting their isVisible property.
>
> The only difference that might happen at close time, which you'd normally want for a document window, is that the window might get released. (In GC terms, there might be no strong references and so the NIB objects can get garbage collected.) That's where things can get a little murky, because there are sometimes unexpected strong references.
>
> The most obvious cause of this kind of lingering is the NIB mechanism itself. Normally, top level objects in a NIB receive an extra retain when loaded (have an extra strong reference, in the GC case). For windows specifically, there is a checkbox in IB that says "release when closed". For a document window, you should check this box so that (presumably) when the window is closed the extra strong reference is discarded.

I have Release when closed checked, but the docs say: "Release when closed, however, is ignored for windows owned by window controllers."

Elsewhere it says:

"The general behavior is as follows:

"• When the last window of a document is closed, the document is also closed. The window, window controller, and document are all released." I'm trying to understand what might stop that from happening.
>
> If that's not it, then use the debugger's 'info gc-roots' command (having set a breakpoint somewhere after the window has been closed and the collector has had time to run, preferably) to find out what's keeping the window alive.

Thanks for the suggestion.

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>

_______________________________________________

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: 
 >Lingering windows (From: Shane Stanley <email@hidden>)
 >Re: Lingering windows (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Lingering windows
  • Next by Date: [SOLVED] Re: CoreData "I/O error for database: no such table"
  • Previous by thread: Re: Lingering windows
  • Next by thread: Re: Lingering windows
  • Index(es):
    • Date
    • Thread