• 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
Object Synthesis - Coredata - KVO Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Object Synthesis - Coredata - KVO Crash


  • Subject: Object Synthesis - Coredata - KVO Crash
  • From: email@hidden
  • Date: Wed, 28 Dec 2005 11:41:57 -0800

Hi List,

I'm running into a crashing problem with a special subclass of NSArrayController.

What my special controller does is it "synthesizes" a key-value object that assembles disparate objects/properties
that are related and zips them up, based on their relation together into NSDictionary objects, thereby synthesizing
an object that is the combination of their respective properties, chosen at runtime.

What's happening is that after assembling the properties together into the NSDictionary (which works perfectly),
is that the NSTableView that observes the properties in the new NSDictionary objects, causes a crash when the
selection changes, or when the content changes. It seems perhaps that the table view tries to observe the contents
of the array of NSDictionaries (the synthesized objects) but when the array disappears, I'm guessing, something
bad happens...

Is there any what to create an amalgam of objects and properties that can not crash KVO?

I can't really use a fetch request because the objects are from a many-to-many with inverse,
so on one side, there are many objects of the same type, its really impossible to know what
I want to see from one end without assembling the to-one values with the "many objects" at the end
of the to-many relation.

IOW I'm looking at the to-many from one end, and saying:
"give me all objects on the other end (inverse) of this to-many relation that are the same kind as me, yet thier "type" relation may be different, so I need to see thier types as well wich lie not in the target objects, but at the other end of my and thier own to-many relation."

Like So:

Person Department Dept. Type
---------- ---------------- ---------------
depts <<---------->> people name:string
type <<----------> depts

Something like:

SELECT all SELF's DEPT's PEOPLE + PEOPLE's dept.type.name




Here's a snippet from a debug session:

Evaluation of the expression containing the function (_NSPrintForDebugger) will be abandoned.
(gdb) po $r18
<NSCFArray 0x6871f00>(
<NSKeyValueObservance: Observer: 0x6871ae0, Key path: arrangedObjects, Include old: NO, Include new: NO, Context: 0x0, Property: 0x4ae1e30>,
<NSKeyValueObservance: Observer: 0x6871ae0, Key path: selectionIndexes, Include old: NO, Include new: NO, Context: 0x0, Property: 0x4ae1cd0>,
<NSKeyValueObservance: Observer: 0x6871ae0, Key path: sortDescriptors, Include old: NO, Include new: NO, Context: 0x0, Property: 0x4ae2a90>
)

(gdb) po 0x4ae1e30
<NSKeyValueUnnestedProperty: Container class: SynthesisArrayController, Key path: arrangedObjects, isa for autonotifying: NSKVONotifying_SynthesisArrayController, Other trigger keys: <NSCFSet: 0x4a2a7a0> (abstractSynthesisKeys, toManyKeyPath)>

(gdb) po 0x4ae1cd0
<NSKeyValueUnnestedProperty: Container class: SynthesisArrayController, Key path: selectionIndexes, isa for autonotifying: (null), Other trigger keys: (null)>

(gdb) po 0x4ae2a90
<NSKeyValueUnnestedProperty: Container class: SynthesisArrayController, Key path: sortDescriptors, isa for autonotifying: (null), Other trigger keys: (null)>


(gdb) po 0x6871ae0
<NSTableBinder: 0x6871ae0>{object: <NSTableView: 0x6189de0>, bindings: content=arrangedObjects, selectionIndexes=selectionIndexes, sortDescriptors=sortDescriptors}

(gdb) po 0x6189de0
<NSTableView: 0x6189de0>


Here is the stack trace:

#0 0x9073fba4 in CFRetain
#1 0x92964b60 in _NSKeyValueObservationInfoCreateByRemoving
#2 0x92964938 in -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:]
#3 0x92964828 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
#4 0x92964778 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
#5 0x938d931c in -[_NSModelObservingTracker _registerOrUnregister:observerNotificationsForModelObject:]
#6 0x938d0d9c in -[_NSModelObservingTracker clearAllModelObjectObserving]
#7 0x938d0c48 in -[_NSModelObservingTracker setIndexReferenceModelObjectArray:clearAllModelObjectObserving:]
#8 0x938d2f40 in -[NSTableBinder _updateContent]
#9 0x938d2dc4 in -[NSTableBinder _observeValueForKeyPath:ofObject:context:]
#10 0x938d2ba8 in -[NSTableBinder observeValueForKeyPath:ofObject:change:context:]
#11 0x92965144 in -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:]
#12 0x938d6bec in -[NSController _notifyObserversForKeyPath:change:]
#13 0x938d6a04 in -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#14 0x938d6108 in -[NSArrayController setContent:]
#15 0x938d5928 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#16 0x92965144 in -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:]
#17 0x938d6bec in -[NSController _notifyObserversForKeyPath:change:]
#18 0x000f37bc in -[SynthesisArrayController setContent:] at SynthesisArrayController.m:108
#19 0x938d5928 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#20 0x92965144 in -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:]
#21 0x938d6bec in -[NSController _notifyObserversForKeyPath:change:]
#22 0x938d6a04 in -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#23 0x938d6108 in -[NSArrayController setContent:]
#24 0x938d5928 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#25 0x92965144 in -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:]
#26 0x938d6bec in -[NSController _notifyObserversForKeyPath:change:]
#27 0x938d6a50 in -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#28 0x938d6954 in -[NSArrayController _selectObjectsAtIndexesNoCopy:avoidsEmptySelection:sendObserverNotificat ions:forceUpdate:]
#29 0x938d8c10 in -[NSArrayController _selectObjectsAtIndexes:avoidsEmptySelection:sendObserverNotifications:f orceUpdate:]
#30 0x938d8b9c in -[NSArrayController setSelectionIndexes:]
#31 0x00077df8 in -[NSArrayController setSelectionIndexes:] at NSArrayController.m:82
#32 0x92967b30 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#33 0x938d852c in -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotAppli cableKeys:error:]
#34 0x938d83b4 in -[NSBinder setValue:forBinding:error:]
#35 0x93b4a464 in -[NSTableBinder tableView:didChangeToSelectedRowIndexes:]
#36 0x93b3a6d0 in -[_NSBindingAdaptor tableView:didChangeToSelectedRowIndexes:]
#37 0x9372bc98 in -[NSTableView _enableSelectionPostingAndPost]
#38 0x93740da4 in -[NSTableView mouseDown:]
#39 0x936e0660 in -[NSWindow sendEvent:]
#40 0x936896f4 in -[NSApplication sendEvent:]
#41 0x93680b30 in -[NSApplication run]
#42 0x93771618 in NSApplicationMain
#43 0x00012fac in main at main.m:14

_______________________________________________
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
  • Prev by Date: Re: Multiple Views in a NSScrollView
  • Next by Date: Re: looking for a cocoa programmer ( paid job )
  • Previous by thread: Re: Embedding Flash in .app
  • Next by thread: NSURLConnection Crash Help Needed
  • Index(es):
    • Date
    • Thread