Re: NSTableView not retaining its data source. What to do?
Re: NSTableView not retaining its data source. What to do?
- Subject: Re: NSTableView not retaining its data source. What to do?
- From: Dan Bernstein <email@hidden>
- Date: Mon, 19 Nov 2001 09:39:49 +0200
On Monday, November 19, 2001, at 06:07 AM, Brian Webster wrote:
Are you releasing the drawer? When you load a nib file, you (i.e. the
file's owner) are responsible for releasing all of the top level
objects.
As I said, "I" am a NSWindowController subclass, and according to the
docs, "...the window controller is responsible for freeing all top-level
objects in the nib file it loads", and "As a consequence of
autoreleasing itself, a NSWindowController autoreleases its window as
well as all all other top-level objects in its nib file".
All of the subviews of the top level windows and drawers are released
automatically, but only when you release the top level object. If you
don't release the drawer, the NSTableView it contains won't be
deallocated and thus will continue to exist and attempt to access its
data source. I think. :)
My guess is that the NSTableView does get released eventually (but I'd
have to subclass it, override dealloc and set a breakpoint there to find
out) but that it happens only on the next iteration of the run loop.
Anyway, as of now I seem to be unable to reproduce the bug (it only
happened under certain circumstances in the first place), but it still
bothers me.
--
Dan Bernstein