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: Matt Neuburg <email@hidden>
- Date: Thu, 22 Dec 2011 16:19:22 -0800
On Dec 22, 2011, at 3:58 PM, Roland King wrote:
>
> 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.
Excellent - thanks for drawing that distinction. m.
--
matt neuburg, phd = email@hidden, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
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