void validateForSave {
super.validateForSave()
fixArchivedButReallyUnchangedItemsFromSnapshot() // <=== this is line 980 ===
“fix” sounds like “change EO object state”. Note carefully that the name of the method is validateForSave, not validateForSaveAndChangeDataBehindEOFsBack. EO state should not change during validation.
Hmmm, this might be the culprit.
The trick is, this being my old application, I am saving serialized NSDictionaries to BLOBs, and I've found there were *lots* of superfluous updates, which I have tracked to the sad fact that serialization (through ObjectOutput/InputStream)
tends to create different NSDatas from same objects. Thus, I've aded essentially this code:
===
void fixArchivedButReallyUnchangedItemsFromSnapshot {
NSDictionary ss=this.editingContext().committedSnapshotForObject(this)
NSDictionary d=this.changesFromSnapshot(ss)
d.each { String k,v ->
if (k.hasSuffix('_archivedNSObject')) { // all my BLOB attributes have this kind of name
def vd=Archivation.objectFromArchivedData(v) // Archivation uses ObjectOutput/InputStream to...
def ssvd=Archivation.objectFromArchivedData(ss[k]) // ...turn objects to NSData and back
if (vd==ssvd) this.takeValueForKey(ss[k],k)
}
}
}
}
===
and it did fix those superfluous updates all right... but perhaps it brought another problems?
I'll try to move this out from validateForSave, just before saveChanges...
Thanks,
OC