Re: Get error message about registered observers when Object receives dealloc message
Re: Get error message about registered observers when Object receives dealloc message
- Subject: Re: Get error message about registered observers when Object receives dealloc message
- From: Roland King <email@hidden>
- Date: Sun, 30 Aug 2009 12:38:06 +0800
On 30-Aug-2009, at 11:24, Graham Cox <email@hidden> wrote:
I believe the issue lies in the fact that an object that has KVO
observers registered on it is not the object you think it is. It's
in fact a sort of proxy for the "real" object that has been swizzled
(you can see this in the debugger as the class will be
KVONotifying_Whatever). When the last observer is removed it's
swizzled back to the original class. The question would be just how
possible/safe this would be to do in -dealloc.
I didn't know the object was unswizzled again when the last observer
is removed, but I can see how it might be.
Nevertheless, I think it's a moot point. Apple have decreed that
removing observers in dealloc is too late; it flags a fairly stern
warning about doing it - a warning that got much more strongly
worded between 10.4 and 10.5.
Where? Where have they decreed this? That's what I'm missing. If
you're using the fact of the message being logged then please can you
explain the release note which I didn't find but did copy/paste into
my last mail. As far as my reading of it says, it covers exactly the
original poster's situation and says unregistation in that way is fine
and the warning message being logged was a bug.
One way or another, I think Andreas has to re-jig his design.
--Graham
_______________________________________________
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