• 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: NSTableView not retaining its data source. What to do?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView not retaining its data source. What to do?


  • Subject: Re: NSTableView not retaining its data source. What to do?
  • From: Brian Webster <email@hidden>
  • Date: Sun, 18 Nov 2001 22:07:40 -0600

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. 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. :)

On Sunday, November 18, 2001, at 06:34 PM, cocoa-dev-
email@hidden wrote:

I have a NSTableView inside a drawer belonging to a window. The window
is owned by a NSWindowController subclass which serves also as the
NSTableDataSource for the NSTableView and as NSWindow delegate. When the
window controller gets a windowWillClose, it does [self autorelease]
(since the it does not belong to a NSDocument). What happens then is
that if the drawer was open and items were selected in the NSTableView,
the NSTableView will call the window controller (which is its data
source) *after* it's been deallocated.

Is this normal? If it is, is it a bug in NSTableView? Anyway, what can I
do to avoid it? (Is it OK to setDataSource of the NSTableView to nil
when the original data source is deallocated? Is it better to remove the
NSTableView from its superview, and thus hopefully have it deallocated
before its data source is?)


--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster


  • Follow-Ups:
    • Re: NSTableView not retaining its data source. What to do?
      • From: Dan Bernstein <email@hidden>
  • Prev by Date: Re: Embedding a picture into a disk image
  • Next by Date: loading a Nib in Java
  • Previous by thread: Re: NSTableView not retaining its data source. What to do?
  • Next by thread: Re: NSTableView not retaining its data source. What to do?
  • Index(es):
    • Date
    • Thread