On Aug 1, 2010, at 18:31, Jerry Krinock wrote:

> When initializing an NSPersistentDocument with sqlite store in a Mac app, I 
> insert what I call a "singleton" managed object, like the "Department" in 
> DepartmentAndEmployees.  It's simply a container which has a to-many 
> relationship to its containees (i.e., employees).  Delete Rule is Nullify.
> 
> I've reproduced a bug whereupon, during some seemingly unrelated Core Data 
> operations, this singleton object, which was in the store initially, is gone. 
>  I know this from saving the document, and then dumping the document file 
> using sqlite3.  The related CREATE TABLE and CREATE INDEX statements are 
> still there, but the singular INSERT INTO statement is gone.
> 
> I tried to break in the debugger when the object disappears, by overriding 
> -willTurnIntoFault, -didTurnIntoFault, and -validateForDelete:, but none of 
> these messages are received.
> 
> Sometimes other objects disappear too, and it's possible that the store is 
> being "hosed" more generally.  But, oddly, I don't get even a peep from Core 
> Data in console.  It even loads OK if I close and reopen the document.

Are you sure this isn't just a memory management error, perhaps in combination 
with an incorrect delete rule? What's the delete rule for the "department" 
relationship in the "Employee" entity?  Is there a strong reference that keeps 
the singleton "Department" alive even when there's no fetched "Employee" or 
unfaulted "Employee" in memory?

If the disappearance is a result of the singleton being disposed of (for 
whatever reason), would Instruments' Object Allocations tell you anything about 
why or when or where the singleton died?


_______________________________________________

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

Reply via email to