Skip navigation.
 
mlcore-data crash on save.
FROM : John Clayton
DATE : Tue Nov 18 09:27:21 2008

Hi All,

I've got a core-data relationship crash problem that I'd like to 
share, see if anyone out there has an idea of what I'm doing wrong. 
This is related to my recent question of knowing when an object is 
deleted (subject: core data - delete of object).

The relationship in my graph is a to-many, from a Layer to an Effect 
(layers have many effects).  Obviously, both Layer and Effect are 
derived from NSManagedObject.

In my program I have a check-box that switches a particular effect on/
off, an opacity fade in this case.  Switching the effect off will 
delete the effect from the core-data graph in the following manner:
   A - remove the effect object from the list of effects on the layer 
(using core-data generated set accessor method)
   B - delete the effect instance (using the managed object context 
deleteObject: method)

switching it on (via the checkbox) adds a new Effect instance back 
into the graph.  My requirements are, among other things:
  1 - when a layer effect is deleted, reflect the change immediately 
in the UI
  2 - don't orphan data objects in the DB

requirement #1 here is the interesting one.  If I DO NOT perform Step 
A, then I fail requirement #1, because step (B), while working - is 
'lazy' in the sense that I'll only see the delete at save time.  if I 
DO NOT perform step B, then I end up orphaning the effect object (fail 
on #2), but I do fullfil requirement #1.  I'd like to have both - 
however, if I perform both Step A and Step B, I crash on save (with 
what appears to be a double delete - i.e. msg send to a dead object) :

#0    0x92a8d688 in objc_msgSend
#1    0x92c147c0 in NSKVOPendingNotificationCreate
#2    0x92cc9b78 in -[NSObject(NSKeyValueObservingPrivate) 
_willChangeValuesForKeys:]
#3    0x9269bafb in -[NSFaultHandler turnObject:intoFaultWithContext:]
#4    0x92667596 in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
_processRecentlyForgottenObjects:]
#5    0x92666177 in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
_processRecentChanges:]
#6    0x92664e70 in -[NSManagedObjectContext executeFetchRequest:error:]
#7    0x9556786c in -[_NSManagedProxy fetchObjectsWithFetchRequest:error:]
#8    0x95409d2f in -[NSArrayController(NSManagedController) 
_performFetchWithRequest:merge:error:]
#9    0x95566d97 in -[NSObjectController(NSManagedController) 
fetchWithRequest:merge:error:]
#10    0x95567d9d in -[_NSManagedProxy _storesDidChange:]
#11    0x92b941da in _nsnote_callback
#12    0x96fa4aba in __CFXNotificationPost
#13    0x96fa4d93 in _CFXNotificationPostNotification
#14    0x92b91440 in -[NSNotificationCenter 
postNotificationName:object:userInfo:]
#15    0x9265d9eb in -[NSPersistentStoreCoordinator(_NSInternalMethods) 
_postStoresChangedNotificationsForStores:changeKey:options:]
#16    0x92652b40 in -[NSPersistentStoreCoordinator 
addPersistentStoreWithType:configuration:URL:options:error:]
#17    0x9557e35b in -[NSPersistentDocument 
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error
:]
#18    0x00003cdb in -[AnnotateDocument 
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error
:] at AnnotateDocument.m:143
#19    0x9557f31d in -
[NSPersistentDocument(NSPersistentDocumentDeprecated) 
configurePersistentStoreCoordinatorForURL:ofType:error:]
#20    0x9557e8e7 in -[NSPersistentDocument 
writeToURL:ofType:forSaveOperation:originalContentsURL:error:]
< ... snip ... >

Are there core-data debugging macros, goodies, command line switches, 
env variables or some other magic I can use to help find the problem 
here?

Thanks
--
John Clayton
Skype: johncclayton

Related mailsAuthorDate
mlcore-data crash on save. John Clayton Nov 18, 09:27
mlRe: core-data crash on save. Quincey Morris Nov 18, 19:06
mlRe: core-data crash on save. John Clayton Nov 18, 22:53
mlRe: core-data crash on save. Ashley Clark Nov 18, 23:08
mlRe: core-data crash on save. Quincey Morris Nov 19, 00:43
mlRe: core-data crash on save. [SOLVED] John Clayton Nov 20, 00:20