• 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
Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS


  • Subject: Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS
  • From: Tony Romano <email@hidden>
  • Date: Thu, 27 May 2010 14:59:44 -0700

Thanks Nick.
On May 27, 2010, at 2:21 PM, Nick Zitzmann wrote:

>
> On May 27, 2010, at 2:58 PM, Tony Romano wrote:
>
>> Below is some code that handles mount and unmount notifications for volumes.  During an unmount, I want to remove the item from the NSTreeController's arrangedObjects list.  The mount sections works fine, it appends to the tree any new volumes added.  When I want to unmount it, I go through the process of finding which NSTreeNode represents my object, get the index path to the tree node and call removeObjectAtArrangedIndexPath:tn .  This is where it access faults.  My debug output gives a valid row and the correct IndexPath.  I also verified via gdb console that the treenode is the correct item that contains my object that represents the volume.  Here is the call stack and the code.  Any ideas as to why it is crashing here?
>
> I do:
>
>> 		NSArray *childNodes = [[outlineController arrangedObjects] childNodes];
>>
>> 		for (NSTreeNode *tn in childNodes) {
> [...]
>> 				[outlineController removeObjectAtArrangedObjectIndexPath:path];
>> 			}
>> 		}
>
> If you're going to do something like that, then you need to work on a copy of the enumerated array. You cannot mutate collection objects that are being enumerated.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>

-Tony

_______________________________________________

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

References: 
 >removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS (From: Tony Romano <email@hidden>)
 >Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Exit( ) necessary? (oalTouch sample project)
  • Next by Date: Re: isKindofClass with NSData and NSKeyUnarchiver
  • Previous by thread: Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS
  • Next by thread: Exit( ) necessary? (oalTouch sample project)
  • Index(es):
    • Date
    • Thread