• 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
Problem with changes to NSArrayControllers array causing crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with changes to NSArrayControllers array causing crash


  • Subject: Problem with changes to NSArrayControllers array causing crash
  • From: Grant Christensen <email@hidden>
  • Date: Tue, 19 Jan 2010 08:52:07 +1000

Hi all, I have problem with a NSTableView bound to an NSArrayController bound to an NSMutableArray in my controller class.

After the following sequence I get a crash:

1) start application
2) request download of data
3) populate data into mutable array
4) show the view
5) ask for another download
6) removeobjects from the array
7)add new objects to array

I get the following crash on the remove:

2010-01-18 23:59:44.614 xxx[8944:5537] An uncaught exception was raised
2010-01-18 23:59:44.615 xxx[8944:5537] *** Collection <NSConcreteHashTable: 0x2003e53a0> was mutated while being enumerated.NSHashTable (%@) {

}
'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x00007fff85b48444 __exceptionPreprocess + 180
	1   libobjc.A.dylib                     0x00007fff849cf0f3 objc_exception_throw + 45
	2   CoreFoundation                      0x00007fff85b9f66f __NSFastEnumerationMutationHandler + 303
	3   Foundation                          0x00007fff81684839 -[NSConcreteHashTable countByEnumeratingWithState:objects:count:] + 78
	4   AppKit                              0x00007fff832891fb -[_NSModelObservingTracker clearAllModelObjectObserving] + 308
	5   AppKit                              0x00007fff83363c2f -[_NSModelObservingTracker setIndexReferenceModelObjectArray:clearAllModelObjectObserving:] + 42
	6   AppKit                              0x00007fff834043c0 -[NSTableBinder _updateContent] + 89
	7   AppKit                              0x00007fff83404280 -[NSTableBinder _observeValueForKeyPath:ofObject:context:] + 91
	8   AppKit                              0x00007fff83404093 -[NSTableBinder observeValueForKeyPath:ofObject:change:context:] + 68
	9   Foundation                          0x00007fff8168718d -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 991
	10  AppKit                              0x00007fff83286132 -[NSController _notifyObserversForKeyPath:change:] + 218
	11  AppKit                              0x00007fff8338fceb -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 63
	12  AppKit                              0x00007fff8336417b -[NSArrayController setContent:] + 899
	13  AppKit                              0x00007fff83402129 -[NSArrayDetailBinder _refreshDetailContentInBackground:] + 1301
	14  Foundation                          0x00007fff81680d8e NSKeyValueDidChange + 458
	15  Foundation                          0x00007fff817531b5 -[NSObject(NSKeyValueObserverNotification) didChange:valuesAtIndexes:forKey:] + 134
	16  Foundation                          0x00007fff8174bbc9 -[NSKeyValueNotifyingMutableArray removeObjectAtIndex:] + 170
	17  CoreFoundation                      0x00007fff85b54b2e -[NSMutableArray removeAllObjects] + 62
	18  VATSpy                              0x000000010000ed01 -[BBSControllersViewController loadValues] + 282
	19  VATSpy                              0x000000010000e12f -[BBSMainWindowController loadComplete:] + 695
	20  VATSpy                              0x0000000100004912 -[BBSDataMgr loadDataFile:] + 3851
	21  Foundation                          0x00007fff8166de99 __NSThread__main__ + 1429
	22  libSystem.B.dylib                   0x00007fff814c2f8e _pthread_start + 331
	23  libSystem.B.dylib                   0x00007fff814c2e41 thread_start + 13
)
Code is:

	BBSDataMgr *mgr = [BBSDataMgr sharedManager];
	@try {
		if ([mgr clientControllers] != nil) {
			[[mgr updateLock] lock];
			NSArray *arr = [[mgr clientControllers] allValues];

			if ([controllers count] >0])
				[[[self mutableArrayValueForKey:@"controllers"] removeAllObjects];

			[[self mutableArrayValueForKey:@"controllers"] addObjectsFromArray:arr];

			[myTableView reloadData];
		}
	}
	@finally {
		[[mgr updateLock] unlock];
	}


Grant




_______________________________________________

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

  • Follow-Ups:
    • Re: Problem with changes to NSArrayControllers array causing crash
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: Bundle and window server interaction
  • Next by Date: Re: [iphone] Release Navigation View Controller Question
  • Previous by thread: Re: Make sheets open instantly
  • Next by thread: Re: Problem with changes to NSArrayControllers array causing crash
  • Index(es):
    • Date
    • Thread