Exception in NSTreeController:removeObjectAtArrangedObjectIndexPath
Exception in NSTreeController:removeObjectAtArrangedObjectIndexPath
- Subject: Exception in NSTreeController:removeObjectAtArrangedObjectIndexPath
- From: "Doug Knowles" <email@hidden>
- Date: Fri, 21 Jul 2006 17:07:23 -0400
Hi,
I have (surprise) an NSOutlineView bound to an NSTreeController, and
I'm trying to implement a command to remove a leaf node from the
outline. When I invoke NSTreeController's
removeObjectAtArrangedObjectIndexPath on the only leaf node of a
parent, I get an exception:
2006-07-20 09:25:56.590 SLNavigator[4545] *** -[NSCFSet
getObjects:range:]: selector not recognized [self = 0xbe0ff40]
The stack trace is:
#0 0x927531e1 in -[NSException raise]
#1 0x92779fdb in +[NSException raise:format:]
#2 0x928020c2 in -[NSObject doesNotRecognizeSelector:]
#3 0x92726207 in -[NSObject(NSForwardInvocation) forward::]
#4 0x90a51ba1 in _objc_msgForward
#5 0x9270a75d in _NSArrayIndexOfObject
#6 0x927d9219 in -[NSArray indexOfObjectIdenticalTo:]
#7 0x93940dec in -[_NSArrayControllerTreeNode removeObjectAtIndex:]
#8 0x93946960 in -[NSTreeController
_removeObjectsAtArrangedObjectIndexPaths:objectHandler:]
#9 0x93946d61 in -[NSTreeController removeObjectAtArrangedObjectIndexPath:]
#10 0x0000f02d in -[ListViewTreeController
removeObjectAtArrangedObjectIndexPath:] at ListViewTreeController.m:23
#11 0x0000bee4 in -[ListViewWindowController removeItemsFromCategory:]
at ListViewWindowController.m:389
#12 0x934881ac in -[NSApplication sendAction:to:from:]
#13 0x93535eff in -[NSMenu performActionForItemAtIndex:]
#14 0x93535c41 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
#15 0x9353e1de in _NSPopUpCarbonMenu2
#16 0x9353d3d7 in _NSPopUpCarbonMenu1
#17 0x9356bb97 in -[NSCarbonMenuImpl
_popUpContextMenu:withEvent:forView:withFont:]
#18 0x9356ba07 in -[NSMenu _popUpContextMenu:withEvent:forView:withFont:]
#19 0x9356b8e5 in -[NSMenu _popUpContextMenu:withEvent:forView:]
#20 0x9356b8a0 in -[NSMenu _popUpMenuWithEvent:forView:]
#21 0x93477ff5 in -[NSWindow sendEvent:]
#22 0x93469830 in -[NSApplication sendEvent:]
#23 0x93394426 in -[NSApplication run]
#24 0x93388357 in NSApplicationMain
#25 0x00003c0c in main at main.m:13
A few notes:
1) Again, it *only* occurs when I'm deleting the only child of a parent node.
2) It appears that NSTreeController is trying to use an NSArray method
on the NSSet my model object is returning as the children of a node;
am I missing a nuance to implementing my NSTreeController model
objects?
3) Two things I should point out for completeness, although I don't
really think they're a factor here:
3a) I am using the delegate method outlineView:heightOfRowByItem to
implement variable height rows. I mention that for the possibility
that the row height calculations may be involved in exposing this
problem.
3b) I am also using NSTreeController_Extensions (as distributed with
Matt Holiday's DragAndDropOutlineEdit) to maintain the mapping between
outline view items and model objects. I can't find fault in its
implementation; specifically, the index path of the object to be
removed is valid.
4) I've also tried bybassing the model "remove..." method by
manipulating the model directly and relying on KVO and reloadItem: to
refresh the display; this avoids the exception, but the subnode
expansion states are lost, and saving and restoring those states seems
inappropriately complex.
Any ideas or workarounds?
TIA,
Doug Knowles
_______________________________________________
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