• 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: NSTreeController woes... NSZombie at doc closed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTreeController woes... NSZombie at doc closed


  • Subject: Re: NSTreeController woes... NSZombie at doc closed
  • From: Ken Victor <email@hidden>
  • Date: Mon, 12 Jun 2006 11:48:43 -0700

At 8:25 AM -0700 6/12/06, Andrew Farmer wrote:
On 11 Jun 06, at 19:20, Ken Victor wrote:
one of the windows of my core data document app contains an NSOutlineView bound with a NSTreeController. the basics work fine. however, if i expand a row and then close the document, i get the following stack trace:

#0 0x929ffbf8 in -[_NSZombie methodSignatureForSelector:]
<...>

and the following on the console log:

2006-06-11 18:50:03.677 Accounts[12130] *** Selector 'leafKeyPath' sent to dealloced instance 0x1301670 of class NSTreeController.
Break at '-[_NSZombie methodSignatureForSelector:]' to debug.
2006-06-11 18:50:04.809 Accounts[12130] *** -[NSAutoreleasePool dealloc]: Exception ignored while releasing an object in an autorelease pool: *** Selector 'leafKeyPath' sent to dealloced instance 0x1301670 of class NSTreeController.
Break at '-[_NSZombie methodSignatureForSelector:]' to debug.


note that everything close fine if i don't expand any rows while this window is open.

You're probably doing something wrong with memory management somewhere in your code; the NSTreeController is getting released too early.


also, by adding the following line of code to my NSWindowController's subclass dealloc method, the problems also go away...

Mind showing us your dealloc method? It's possible that you're doing things in the wrong order.


below is the dealloc method of my subclassed NSWindowController and the dealloc of its superclass and its superclass dealloc -- all the way up to the first subclass of NSWindowController.

- (void) dealloc {

if ([self comboBoxNotificationsInstalled]) {
[[NSNotificationCenter defaultCenter] removeObserver: self name: newAccountTypeNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: self name: deletedAccountTypeNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: self name: changedAccountTypeNotification object: nil];
}


// uncommenting the below causes the problem to manifest ==========================
// [[(KVWindow*)[self window] arrayController] setManagedObjectContext: nil];


	[super dealloc];
	}


- (void) dealloc {

	[self setDeferredObjectsToSelect: nil];

[[NSNotificationCenter defaultCenter] removeObserver: self name: [[[self class] entityClass] entityDescription]->createdEntityNotificationName object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: self name: [[[self class] entityClass] entityDescription]->changedEntityNotificationName object: nil];
[self setNewEntityWindowController: nil];


	[self setComboBoxNotificationsInstalled: nil];
	[self setPopupNotificationsInstalled: nil];

	[super dealloc];
	}


- (void) dealloc {

	[[NSNotificationCenter defaultCenter] removeObserver: self];

if (NSTableView* table = [[[self window] contentView] viewWithTag: 5491])
[table removeObserver: self forKeyPath: @"sortDescriptors"];


	[self setFilterArray: nil];
	[self setHiddenColumns: nil];
	[self setAllColumns: nil];
	[self setShowColumnsWindowController: nil];
	[self setEditTBI: nil];
	[self setDeleteTBI: nil];
	[[self searchTBI] setView: nil];
	[self setSearchTBI: nil];
	[self setTableFont: nil];
	[self setTableColor: nil];

	[super dealloc];
	}


- (void) dealloc { [self setWindowTemplateName: nil]; [super dealloc]; // super is NSWindowController } _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTreeController woes... NSZombie at doc closed (From: Ken Victor <email@hidden>)
 >Re: NSTreeController woes... NSZombie at doc closed (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: API Path Question
  • Next by Date: Re: API Path Question
  • Previous by thread: Re: NSTreeController woes... NSZombie at doc closed
  • Next by thread: Re: NSTreeController woes... NSZombie at doc closed
  • Index(es):
    • Date
    • Thread