CoreData - re-faulting object and removing self-observers results in messages being sent to zombie
CoreData - re-faulting object and removing self-observers results in messages being sent to zombie
- Subject: CoreData - re-faulting object and removing self-observers results in messages being sent to zombie
- From: Jim Correia <email@hidden>
- Date: Tue, 2 Aug 2005 16:55:43 -0400
I have a CoreData based application. One of my NSManagedObject
subclasses observes itself (for a variety of reasons, but just this
in on the example) so it can keep a lastModified time for each object.
Because the real application (not the sample) uses multiple managed
object contexts there are times when I refault objects in order to
refresh their values. When I do that and I am observing myself this
results in (with zombies enabled)
2005-08-02 16:37:04.048 ObservingSelf[20578] *** Selector
'observeValueForKeyPath:ofObject:change:context:' sent to dealloced
instance 0x397630 of class NSKeyValueObservationForwarder.
Break at '-[_NSZombie methodSignatureForSelector:]' to debug.
If I remove the code which removes myself as an observer of myself in
-[Person didTurnIntoFault] the problem seems to go away (or is
changed sufficiently that I haven't bumped into it yet.)
When/where should I remove self-observers? Doing so in -
didTurnIntoFault seemed prudent until I started crashing because of it.
When/where should I remove observers for other objects?
(As always, I'm happy to file whatever bugs are appropriate, I'm just
not sure if there are framework/doc bugs, or my own at this point.)
Example at: <http://homepage.mac.com/jimcorreia/ObservingSelf.zip>
To reproduce:
- Make a new document.
- Make a person.
- Add some resumé data.
- Save the document. Click the re-fault button.
- Add more resumé data.
- Save the document.
- Crash (nor notice zombies in the log if env variable set.)
Thanks,
Jim _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden