[solved] Re: NSTreeController woes... NSZombie at doc closed
[solved] Re: NSTreeController woes... NSZombie at doc closed
- Subject: [solved] Re: NSTreeController woes... NSZombie at doc closed
- From: Ken Victor <email@hidden>
- Date: Mon, 12 Jun 2006 16:25:15 -0700
i had a category of NSOutlineView that erroneously had a dealloc
method. it was only calling [super dealloc], but removing this
altogether solves my problems.
thanx for listening,
ken
At 3:25 PM -0700 6/12/06, Ken Victor wrote:
after many hours of debugging, i still haven't found and fixed the
root cause for this... but i have gotten some more "interesting
information"
i overrode add/remove observer:forKeyPath: methods in my entity
subclass so i could see what was happening. i've discovered that
when the outline view is instantiated from the nib file, each entity
at the top level (ie, those entities without a parent) are called to
add an _NSArrayControllerTreeNode as an observer. when a row is
expanded, the newly exposed entities are similarly called.
when i close the window, if no rows are expanded, [NSTreeController
dealloc] sends a removeObserver to remove the
_NSArrayControllerTreeNode for each top level entity. however, if
some rows are expanded at the time [NSTreeController dealloc] is
invoked, removeObserver is only sent to the unexpanded top level
entities!
this explains the "zombie call" to the tree controller. but i'm
still at a loss as to what is causing this. i haven't yet been able
to replicate this aberrant behavior is a simplified test app, so i
sorta believe its a bug in my code someplace.
any help/suggestions/advice as to how to get further information
greatly appreciated! please!!! :-)
thanx,
ken
At 7:20 PM -0700 6/11/06, 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:]
#1 0x92925f04 in -[NSObject(NSForwardInvocation) forward::]
#2 0x90a430b0 in _objc_msgForward
#3 0x93c00afc in -[_NSArrayControllerTreeNode
observeValueForKeyPath:ofObject:change:context:]
#4 0x92940acc in -[NSObject(NSKeyValueObserverNotification)
didChangeValueForKey:]
#5 0x940b0760 in -[NSManagedObject didChangeValueForKey:]
#6 0x9409f26c in -[NSFaultHandler turnObject:intoFaultWithContext:]
#7 0x9409ef78 in -[NSManagedObjectContext(_NSInternalAdditions)
_disposeObjects:count:notifyParent:]
#8 0x9409eaf4 in -[NSManagedObjectContext(_NSInternalAdditions) _dispose:]
#9 0x9409e7e4 in -[NSManagedObjectContext dealloc]
#10 0x93c08458 in -[NSPersistentDocument setManagedObjectContext:]
#11 0x93c07fd0 in -[NSPersistentDocument dealloc]
#12 0x000ca5ec in -[KVDocument dealloc] at KVDocument.mm:253
#13 0x00003dc0 in -[KVSubDocDoc dealloc] at KVSubDoc Doc.mm:87
#14 0x93b98824 in -[_NSBindingInfo dealloc]
#15 0x907bf08c in __CFArrayReleaseValues
#16 0x907bedf8 in __CFArrayDeallocate
#17 0x907bbf34 in _CFRelease
#18 0x9390093c in -[NSBinder _dealloc]
#19 0x93b9f5d4 in -[NSObjectParameterBinder _dealloc]
#20 0x9390083c in -[NSBinder dealloc]
#21 0x9290e968 in NSPopAutoreleasePool
#22 0x936d70d4 in -[NSApplication run]
#23 0x937c7bfc in NSApplicationMain
#24 0x00003ac4 in main at main.m:12
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.
also, by adding the following line of code to my
NSWindowController's subclass dealloc method, the problems also go
away:
[[(KVWindow*)[self window] arrayController] setManagedObjectContext: nil];
(arrayController in my KVWindow class returns the NSTreeController
for the outline view)
this makes no sense to me!!! can anyone explain this or point me
to some documentation that might explain it.
thanx,
ken
ps. note that i set a breakpoint at -[NSManagedObject
didChangeValueForKey:] and in the debugger the NSManagedObject was
all zero for the above stack trace.
_______________________________________________
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