On May 7, 2013, at 7:04 AM, Tamas Nagy <tamas.lov.n...@gmail.com> wrote:

> The data collecting and save happening on the main thread, but the objects 
> providing the data may run on an other - rendering - thread. Maybe its a 
> problem with an object while collecting the save data, and I forgot about 
> copy the value?

Copying the value isn't enough! Foundation collections are not thread-safe — 
you shouldn't access a dictionary (or array or set or string) on one thread 
while modifying it on another. The only safe way to share these objects is 
read-only. (There's a whole document in Apple's doc-set about the thread-safety 
of various Cocoa classes. In general, never assume a class is thread-safe 
unless the docs explicitly say so.)

In this specific crash, the presence of "__NSFastEnumerationMutationHandler" in 
the exception backtrace shows that the enumerator detected that the dictionary 
had been modified during the enumeration, which is illegal (even on a single 
thread.)

—Jens
_______________________________________________

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

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

Reply via email to