• 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
NSTreeController, minus set mutation, array exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTreeController, minus set mutation, array exception


  • Subject: NSTreeController, minus set mutation, array exception
  • From: Ken Victor <email@hidden>
  • Date: Mon, 18 Jun 2007 13:02:53 -0700

i've got an outline view bound via a tree controller. the tree controller has its content set bound to a mutable set in my model.

if i attempt to delete several items via the following, everything works as expected:

	NSEnumerator* en = [itemsToDelete objectEnumerator];
	while (id anItem = [en nextObject]) {
		NSSet* delSet = [NSSet setWithObject: anItem];
		[myController willChangeValueForKey: @"proxySet"
			withSetMutation: NSKeyValueMinusSetMutation
			usingObjects: delSet];
		[[myController proxySet] removeObject: anItem];
		[myController didChangeValueForKey: @"proxySet"
			withSetMutation: NSKeyValueMinusSetMutation
			usingObjects: delSet];
		}

on the other hand, if i attempt to delete them all at once (ie, instead of iterating and deleting one at a time) via the following:

	[myController willChangeValueForKey: @"proxySet"
		withSetMutation: NSKeyValueMinusSetMutation
		usingObjects: itemsToDelete];
	[[myController proxySet] minusSet: itemsToDelete];
	[myController didChangeValueForKey: @"proxySet"
		withSetMutation: NSKeyValueMinusSetMutation
		usingObjects: itemsToDelete];

i get an array exception:
	-[NSCFArray objectAtIndex:]: index (41) beyond bounds (41)

with the following back trace:

#5 0x95b43272 in NSExceptionHandlerExceptionRaiser
#6 0x9284923f in +[NSException raise:format:]
#7 0x928a61fc in _NSArrayRaiseBoundException
#8 0x927d89f1 in -[NSCFArray objectAtIndex:]
#9 0x9383c65e in -[_NSArrayControllerTreeNode updateSubnodes]
#10 0x938338dc in -[_NSArrayControllerTreeNode setObservedObject:]
#11 0x9383575c in -[NSTreeController _prepareArrayControllerTree]
#12 0x93838f75 in -[NSTreeController setContent:]
#13 0x93531cc0 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#14 0x928bdc62 in -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:withSetMutation:usingObjects:]
#15 0x0018f17b in -[DeleteOutlineEntityCommand doit] at DeleteOutlineEntityCommand.mm:145



i'm sure i'm doing something wrong, but i just don't know what! can someone please suggest what i might be doing wrong, or point me to some relevant documentation.


thanx,
ken
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: NSTreeController, minus set mutation, array exception
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: Re: Obtaining unpremultiplied bitmap from PNG file
  • Next by Date: Re: text to bezier path
  • Previous by thread: Re: AppleMetricUnits undefined in GlobalPreferences.plist for new user accounts
  • Next by thread: Re: NSTreeController, minus set mutation, array exception
  • Index(es):
    • Date
    • Thread