KVO persists too long
KVO persists too long
- Subject: KVO persists too long
- From: "Jim Thomason" <email@hidden>
- Date: Sat, 30 Jun 2007 17:26:42 -0500
I'm stumped. I have a coredata document based app with a master-detail
interface (debts and line items).
Now here's the issue. I can add a debt just fine, and add multiple line
items (mostly) just fine. The problem seems to manifest under these
conditions -
1) Add a new debt
2) Add a bunch of empty stock line items, say about 10-15 of 'em.
3) Delete the debt.
Boom. Now, making this even more fun, the boom is different each time. The
problem seems to be that the tableview observing the column in the detail
table is "forgetting" to release its observer.
For example, one of the observers may look like this:
<NSKeyValueObservationForwarder: 0x4a91d0>
When I'm delete the debt (and let the line items delete via the coredata
cascade, I'm not doing that explicitly myself), sometimes it'll work just
fine. With a small number of line items (say up to about 4), there's no
issue.
Greater than that, one of several things may happen:
1) I'll get an exception that's ignored, such as this one:
2007-06-30 17:23:42.018 Debtinator[12319] Exception raised during posting of
notification. Ignored. exception: ***
-observeValueForKeyPath:ofObject:change:context: only defined for abstract
class. Define -[NSDecimalNumber
observeValueForKeyPath:ofObject:change:context:]!
You'll note that it's trying to call observeValueForKeyPath on an
NSDecimalNumber in this case. So I'm assuming that the original
observationforwarder has been removed and the memory address recycle to a
decimal number, which in turn fails.
2) It'll crash because the observation forwarder is wiped out and there's
nothing put back into that memory slot.
3) It'll crash when trying to remove the observer.
And I've been banging my head against the wall for hours on this. Where do I
need to look or what can I look for to help track this down? I'd post a
boiled down example, but I haven't been able to create one yet. So
presumably there's something somewhere in my code that's causing this, but I
don't even know where to look.
To emphasize, I'm not adding any observers myself, these are just the
observers added by the system. And my current speculation is that they're
not always getting removed when they're supposed to, but I'm just grasping
at straws.
Anyone have any suggestions for what I should look for to try and track this
down?
Many thanks,
-Jim...
_______________________________________________
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