Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-06 Thread Ben Trumbull
Well, that was quick. With NSZombieEnabled, I get this when deallocating my context: *** -[VetVisit_VetVisit_ _hasRetainedStoreResources]: message sent to deallocated instance 0x16b85600 VetVisit is class that represents an Entity in my object model - the Pet entity has a collection of VetVisit

Re: Crashing resetting or releasing an NSManagedObjectContext [SOLVED]

2009-05-06 Thread Daniel Kennett
*Sigh* All this effort, and it turns out to be a one-line fix. Obviously. [NSManagedObjectContext -setRetainsRegisteredObjects:YES] Calling that on the context solves all the problems I was having, and everything works perfectly now! Thanks, -- Daniel ___ dan...@

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-05 Thread Daniel Kennett
Thank you again for your helpful replies! On a different note, when you comment out the "for (VetVisit" code, does it still crash on a VetVisit, or does it crash on a "Medication" object? It still crashes on a VetVisit object. I don't think I've solved the problem, but I have stopped it

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-04 Thread Keary Suska
On May 1, 2009, at 2:24 AM, Daniel Kennett wrote: Thanks for your reply. Yes, I have code that triggers relationship faults, and removing that code solves the problem. However, I need that code to work! :-) When fetching the data from the object tree, I call a method on the pet instance c

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-04 Thread Keary Suska
On May 4, 2009, at 11:59 AM, Alexander Spohr wrote: You are still having the same error. Although the advice is sound, the premise is false. All your objects in the relationships are fetched. Therefore they are owned by the NSManagedObjectContext. You kill the NSManagedObjectContext by re

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-04 Thread Alexander Spohr
You are still having the same error. All your objects in the relationships are fetched. Therefore they are owned by the NSManagedObjectContext. You kill the NSManagedObjectContext by releasing it. After that point you are not allowed to touch any of its fetched objects. But you hand them ou

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-05-04 Thread Daniel Kennett
Good morning all, Thanks for your reply. Yes, I have code that triggers relationship faults, and removing that code solves the problem. However, I need that code to work! :-) When fetching the data from the object tree, I call a method on the pet instance called -pertinentActions. This me

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-04-30 Thread Keary Suska
On Apr 30, 2009, at 10:55 AM, Daniel Kennett wrote: Hi again, Well, that was quick. With NSZombieEnabled, I get this when deallocating my context: *** -[VetVisit_VetVisit_ _hasRetainedStoreResources]: message sent to deallocated instance 0x16b85600 VetVisit is class that represents an

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-04-30 Thread Daniel Kennett
Hi again, Well, that was quick. With NSZombieEnabled, I get this when deallocating my context: *** -[VetVisit_VetVisit_ _hasRetainedStoreResources]: message sent to deallocated instance 0x16b85600 VetVisit is class that represents an Entity in my object model - the Pet entity has a coll

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-04-30 Thread Daniel Kennett
Thank you to you and Keary for your reply. This is what the // copy out some data code does: NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; [dict setValue:[[[pet valueForKey:@"name"] copy] autorelease] forKey:@"name"]; [dict setValue:[[[pet valueForKey:@"birthday"] copy] auto

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-04-29 Thread Alexander Spohr
Daniel, You are trying to fetch an object and keep it - but you want to ignore / throw away the NSManagedObjectContext. This will never work. The NSManagedObjectContext keeps the object. Your Pet can not exist without its NSManagedObjectContext. You should let the caller provide a NSManag

Re: Crashing resetting or releasing an NSManagedObjectContext

2009-04-29 Thread Keary Suska
On Apr 29, 2009, at 2:59 AM, Daniel Kennett wrote: Different combinations of trying to do this right result in crashes at different points. Leaving out [context reset] and just releasing it obviously gives EXC_BAD_ACCESS again. Autoreleasing the MOC in +petAtURL: causes crashes when the aut