From: Laurent S. <lsa...@ap...> - 2007-12-03 00:32:27
|
On Dec 3, 2007, at 1:20 AM, Tim Burks wrote: > > Hi Tim, > > Your post reminded me of a problem that I recently had while working > with Nu. So I ported your example to Nu and saw the same message. > I think the problem is in the PSMTabBarControl framework. If you > look at PSMTabBarControl.m, you'll see this method: > > - (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView > { > NSArray *tabItems = [tabView tabViewItems]; > // go through cells, remove any whose representedObjects are not > in [tabView tabViewItems] > NSEnumerator *e = [_cells objectEnumerator]; > PSMTabBarCell *cell; > while(cell = [e nextObject]){ > if(![tabItems containsObject:[cell representedObject]]){ > [self removeTabForCell:cell]; > } > } > ... > > This method is, in fact, mutating the _cells collection while it is > enumerating it. I've heard that Leopard treats this more strictly, > so that might explain the exception. I modified this method, > replacing the call that creates the object enumerator with this: > [...] Definitely, good catch! FYI, the rationale behind this new exception is explained in http://developer.apple.com/releasenotes/Cocoa/Foundation.html in the "Warning about mutations during enumerations" section. Laurent |