Hi !

I'm having strange crashes in my threaded core data application. Happy WWDC is in few days!

Core Data multithreading basic rule is to avoid passing managed objects across threads, and pass objectIDs instead.

To "synchronize" 2 mocs from 2 different threads (sharing the same psc), I use mergeChangesFromContextDidSaveNotification:. As Apple demonstrate in the documentation, I use performSelectorInMainThread: since I just want to synchronize my main moc, in the main thread, with inserted objects, created in a second moc, in a subthread. So there is no need to lock.

But the mergeChangesFromContextDidSaveNotification: method uses the notification as an argument, and the userInfo of this notification contains managed objects, not objectIDs! Managed objects are then passed from sub thread to mainthread...

Isn't it a violation of the basic rule described below?


Aurélien,
Objective Decision Team




_______________________________________________

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