On Aug 10, 2010, at 2:55 PM, Rick Mann wrote:

> We have an app that uses a "main" NSManagedObjectContext (MOC) for all 
> UI-related work, and has background threads that add and update data via 
> their own dedicated MOCs. When they call -save: on their MOC, the "main" MOC 
> gets the NSManagedObjectContextDidSaveNotification and calls 
> -mergeChangesFromContextDidSaveNotification:.
> 
> The problem is, this actually happens on the thread that called -save:, not 
> on the main thread. We're seeing occasional crashes, and suspect that it is 
> due to this problem. However, I didn't see anything in the docs that said we 
> had to call -save: from the main thread, or take any special steps when 
> handling that notification.
> 
> Did I just overlook something, or should this work safely always? It seems 
> like the latter is unlikely, since two threads could be accessing a MOC 
> simultaneously.

Are you following or taking into account everything shown here: 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW1
 ?

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to