Trouble with core data and Save As
Trouble with core data and Save As
- Subject: Trouble with core data and Save As
- From: Gideon King <email@hidden>
- Date: Sat, 27 Feb 2010 16:50:50 +1000
I'm having another look at an issue I posted about a couple of weeks ago, where Save As was causing an error. At the time, I was using a custom managed object context. I have now reverted to a standard managed object context. I do not create or release this managed object context anywhere - it gets automatically created when I first access it from my persistent document...but this context is not where the problem occurs.
When I do a Save As, it migrates to a new store behind the scenes, it appears to load my objects into the new store OK, and accesses the attributes OK, but then I get a crash where it tries to send a message to a deallocated NSManagedObjectContext. This context is created by core data internally as Instruments shows:
# Category Event Type RefCt Timestamp Address Size Responsible Library Responsible Caller
0 NSManagedObjectContext Malloc 1 00:28.911 0x11d0d58a0 240 CoreData -[NSPersistentStoreCoordinator(_NSInternalMethods) _retainedAllMigratedObjectsInStore:toStore:]
1 NSManagedObjectContext Autorelease 00:28.953 0x11d0d58a0 0 CoreData -[NSPersistentStoreCoordinator(_NSInternalMethods) _retainedAllMigratedObjectsInStore:toStore:]
2 NSManagedObjectContext Zombie -1 00:28.955 0x11d0d58a0 0 CoreData -[NSManagedObjectContext(_NSInternalAdditions) _dispose:]
As far as I can see, I never get a look in. It all appears to be triggered by [NSPersistentStoreCoordinator migratePersistentStore:toURL:options:withType:error:].
But obviously there must be something somewhere in my code causing this problem.
I am just totally clueless as to where to look, and would appreciate any suggestions.
I thought there might be something happening in one of my awake... methods or a dealloc or willTurnIntoFault or didTurnIntoFault, but I didn't find anything that looked suspicious. The store is an NSAtomicStore subclass, and I read that there could be problems with Save As if newReferenceObjectForManagedObject: did not return a constant value, but that isn't called before it crashes...so I'm stuck.
Any ideas?
TIA
Gideon
_______________________________________________
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