• 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
Selector sent to dealloced instance of class NSKeyValueObservationForwarder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Selector sent to dealloced instance of class NSKeyValueObservationForwarder


  • Subject: Selector sent to dealloced instance of class NSKeyValueObservationForwarder
  • From: Ken Victor <email@hidden>
  • Date: Fri, 22 Jun 2007 17:49:13 -0700

background environment:
i've got a core data document based app. if the user closes a document with changes and specifies to not save changes, i rollback the managed object context, write some state information to the context and save the context.


specific environment:
one of my document windows has an outline view bound to a tree controller. the tree controller has its content set bound (programmatically) to a mutable set in one of my model objects (KVModelObject). the objects (KVOutlineObject) in this mutable set are subclassed from NSObject and have an iVar that can point to different subclasses of NSManagedObject. KVOutlineObject implements valueForUndefinedKey: to "feed" the tree controller/outline view. i add new rows to the outline via:
NSMutableSet* mps = [KVModelObject mutableSetValueForKey: @"proxySet"];
[mps addObject: newObject];
(newObject is an instance of KVOutlineObject that will contain a newly created subclass of NSManagedObject).


this all works fine, and the new item shows up fine in the outline view.

the problem:
if i expand the newly created and inserted item, and then close the document discarding changes, i get the below exception and stack trace.


empirically, i have discovered that if i use a simple key instead of using a compound keyPath for 2 of the columns, the problem goes away! ie, originally, 2 of the columns in the outline view were bound (in IB) to model keys:

	arrangedObjects.account.name, and arrangedObjects. taxCategory.name

and -[KVOutlineObject valueForUndefinedKey:] (for keys: account and taxCategory) would return the appropriate objects that would then respond to the name request.

if i changed the binding for these two columns (in IB) to be

	arrangedObjects.accountName and arrangedObjects.taxCategoryName

and provided the support for these new keys in -[KVOutlineObject valueForUndefinedKey:] the problem goes away.

as i've already spent 1-2 days on getting to this "solution", i can live with it, but i don't understand why or what was causing the problem. can anyone please provide some explanations?

thanx very much,
ken


*** Selector 'observeValueForKeyPath:ofObject:change:context:' sent to dealloced instance 0x2576ca80 of class NSKeyValueObservationForwarder.


#8 0x928d18c2 in -[_NSZombie methodSignatureForSelector:]
#9 0x927f52f4 in -[NSObject(NSForwardInvocation) forward::]
#10 0x90a5acc1 in _objc_msgForward
#11 0x927de344 in -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:]
#12 0x93cd0038 in -[NSManagedObject didChangeValueForKey:]
#13 0x93cbb9c8 in -[NSFaultHandler turnObject:intoFaultWithContext:]
#14 0x93cbb558 in -[NSManagedObjectContext(_NSInternalAdditions) _disposeObjects:count:notifyParent:]
#15 0x93cbb067 in -[NSManagedObjectContext(_NSInternalAdditions) _dispose:]
#16 0x93cbacf7 in -[NSManagedObjectContext dealloc]
#17 0x9383ce4e in -[NSPersistentDocument setManagedObjectContext:]
#18 0x9383c9da in -[NSPersistentDocument dealloc]
#19 0x000a76a4 in -[KVDocument dealloc] at KVDocument.mm:252
#20 0x00003015 in -[AccountsDoc dealloc] at AccountsDoc.mm:177
#21 0x937c6283 in -[_NSBindingInfo dealloc]
#22 0x9080d094 in CFRelease
#23 0x90810930 in __CFArrayReleaseValues
#24 0x9080d169 in _CFRelease
#25 0x93507546 in -[NSBinder _dealloc]
#26 0x93507504 in -[NSValueBinder _dealloc]
#27 0x93507446 in -[NSBinder dealloc]
#28 0x9353eab5 in -[NSSelectionBinder dealloc]
#29 0x927d38cf in NSPopAutoreleasePool
#30 0x93286e28 in -[NSApplication run]
#31 0x9327ad2f in NSApplicationMain
#32 0x00002a38 in main at main.m:12
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSEvent mouseDown & [NSEvent type] NSRightMouseDown
  • Next by Date: Unselectable NSTableView with selectable cell controls
  • Previous by thread: Re: OpenHUD dissapear?
  • Next by thread: Unselectable NSTableView with selectable cell controls
  • Index(es):
    • Date
    • Thread