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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to