Core Data Sequence Problem
Core Data Sequence Problem
- Subject: Core Data Sequence Problem
- From: Richard Somers <email@hidden>
- Date: Wed, 20 Oct 2010 11:57:17 -0600
I have a core data document based application with a problem.
Some of the managed objects save a reference to a graphic context.
These managed objects create graphic resources that are subsequently
cleaned up in 'didTurnIntoFault'.
This works fine except for the following condition: A document is
opened which contains an existing managed object, the object is then
removed from the managed object context, and the window is then closed
without saving changes. This results in a crash, because by the time
'didTurnIntoFault' is called, the graphic context is no longer valid.
The sequence of events are as follows:
1. User removes the managed object from the existing document
(using array controller), presses the close window button, changes are
not saved.
2. Managed object is removed from the managed object context by
the frameworks and is no longer reachable by any means that I am aware
of.
3. Method 'windowWillClose' is called by the window closing
machinery and the document window, graphic view, and graphic context
are released.
4. Managed object 'didTurnIntoFault' is finally called but it is
too late, the graphic context is no longer valid!
Does anyone have any idea how I can fix this?
How can I get 'didTurnIntoFault' to be called before the window
closing machinery takes over?
--Richard Somers
_______________________________________________
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