Re: No more warning about registered observers on dealloc with ARC?
Re: No more warning about registered observers on dealloc with ARC?
- Subject: Re: No more warning about registered observers on dealloc with ARC?
- From: Roland King <email@hidden>
- Date: Fri, 23 Dec 2011 07:58:31 +0800
On Dec 23, 2011, at 1:19 AM, Matt Neuburg wrote:
> On Thu, 22 Dec 2011 21:13:07 +0800, Roland King <email@hidden> said:
>> You used to get a handy message logged to the console when an object with KVO registered on it was deallocated, but not in either of these two cases (and I can quite clearly demonstrate that the object was dealloc'ed with dangling KVO). Has that message been removed
>
> No, I can easily generate it - all you have to do is register for KVO and let the object vanish at the end of the scope (which, under ARC, it will if it wasn't assigned to an ivar):
>
> "An instance 0x6805020 of class MyClass1 was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:"
>
> So presumably something else is going on here; perhaps you haven't quite gotten to the root of your problem yet. m.
>
I had, but my memory of the message was flawed. If you have objects A and B, and A observes a property of B and you dealloc B, you get the message, as you showed. In my case A was observing B and A was dealloc()ed without me removing the observation first. Eventually the observed property on B changed and it tried to send a KVO notification to a dead object. Once you posted the text of the message again it was obvious I had the reverse situation.
_______________________________________________
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