On Nov 23, 2010, at 12:38 PM, vincent habchi <vi...@macports.org> wrote:
> However, I have now a repeated memory management crash when I release the moc > (apparently, one managed object get released one time too much: it is > destroyed in the main MOC, while the secondary MOC has a copy of it. When I > release the secondary MOC, it sends somehow an autorelease message to the > destroyed entity and that leads to a crash). > > Wherefore the question I asked to Quincey, that I'm repeating here: > > If I have two MOCs, let's say MOC1, MOC2, and I get in MOC2 the copy of a > MOC1 object: > > Entity * entityInMOC2 = [MOC2 objectWithID:[entityInMOC1 objectID]]; > > and then I traverse a relationship (or execute a fetch request): > > OtherEntity * someOtherEntity = [entityInMOC2 someRelationship]; > > do the variable someOtherEntity refer to an object in MOC1 or in MOC2? The variable someOtherEntity refers to an object in the same context as entityInMOC2, therefore MOC2. I think I see where your issue is though. On this line: > Entity * entityInMOC2 = [MOC2 objectWithID:[entityInMOC1 objectID]]; If your code actually looks like this, it's a bug: You're using entityInMOC1 in another thread. Pass JUST its object ID, not the object itself, from one thread to the other. -- Chris _______________________________________________ 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