Re: Lingering windows

2011-08-10 Thread Quincey Morris
On Aug 9, 2011, at 22:34 , Shane Stanley wrote: In my document class's -makeWindowControllers I'm setting a property to the window controller; could that be the problem? A property of the document? Could be, but you'd have to track through the gc info-roots to find out what's keeping what

Re: Lingering windows

2011-08-10 Thread Shane Stanley
On Aug 10, 2011, at 4:20 PM, Quincey Morris wrote: f you're setting this property just for convenience (after all, you can find the window controller later by examining [document windowControllers]), then maybe you really want this property to be a weak reference? Thanks for the suggestion.

Lingering windows

2011-08-09 Thread Shane Stanley
I have a document-based application that uses garbage collection. It's straight-forward in terms of having subclasses of NSDocument, NSWindow, and NSWindowController, and documents have a single window (with drawer, if that makes any difference). But when I close a window/document, the window

Re: Lingering windows

2011-08-09 Thread Jerry Krinock
On 2011 Aug 09, at 05:24, Shane Stanley wrote: Any thoughts/suggestions? See if -dealloc is running in your NSDocument subclass. Probably not. In that case, it's you're whole document that's lingering, not just the window. Never used garbage collection, so someone else will need to help

Re: Lingering windows

2011-08-09 Thread Quincey Morris
On Aug 9, 2011, at 05:24 , Shane Stanley wrote: I have a document-based application that uses garbage collection. It's straight-forward in terms of having subclasses of NSDocument, NSWindow, and NSWindowController, and documents have a single window (with drawer, if that makes any

Re: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 9, 2011, at 11:50 PM, Jerry Krinock wrote: See if -dealloc is running in your NSDocument subclass. Probably not. In that case, it's you're whole document that's lingering, not just the window. Dealloc isn't called with GC, and the document isn't lingering -- it's just the window.

Re: Lingering windows

2011-08-09 Thread Shane Stanley
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

Re: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 10, 2011, at 3:51 AM, Quincey Morris wrote: 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. So I get this: info gc-roots

Re: Lingering windows

2011-08-09 Thread Quincey Morris
On Aug 9, 2011, at 21:33 , Shane Stanley wrote: info gc-roots 0x4011fcca0 Number of roots: 7 Root: #1 0 Kind: stack rc: 0 Address: 0x7fff5fbfe288 Frame level: 1 Symbol: unknown 1 Kind: object rc: 0 Address: 0x0004011fcca0 Class: MyWindow Root: #2 0 Kind: stack

Re: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 10, 2011, at 3:12 PM, Quincey Morris wrote: Starting at the bottom, the last 3 show strong references to the window from object 0x000400efa2e0. *That* object is being kept alive by 2 stack references (#6 and #7), but it's a root reference in itself. I wouldn't be surprised if