Re: KVO can be unsafe in -init?
Re: KVO can be unsafe in -init?
- Subject: Re: KVO can be unsafe in -init?
- From: John Chang <email@hidden>
- Date: Sun, 13 Sep 2009 17:35:11 +0200
On 13 sep 2009, at 05.33, Jerry Krinock wrote:
I'd be interested to know how John is going to fix this problem. I
myself have used the performSelector:withObject:afterDelay:0.0
solution in situations like this
I think the problem really only happens with the
NSKeyValueObservingOptionInitial option, which causes KVO to make a
bunch of calls to user code (with potentially lots of side effects)
directly inside -addObserver:etc:etc:. So the afterDelay: idea
wouldn't really help, since in both cases -addObserver: is going to be
catching and rethrowing exceptions. (One of our guys noticed that the
crash report had objc_exception_rethrow, instead of
objc_exception_throw, which I never noticed until he pointed it out.)
The solution was to find and fix the root cause of the exception, but
hunting down the source of the exception is the hard part. The above
knowledge, however, should help in the future. We were absolutely down
the wrong path in suspecting self and -init.
/John
_______________________________________________
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