Am Di,05.08.2008 um 12:00 schrieb mmalc crawford:


On Aug 5, 2008, at 2:48 AM, Negm-Awad Amin wrote:

This is the "mirror" of the problem, when you initialize an object. Of course, theoretically in both cases the usage of setters are dangerous. In most cases the deallocation of the object in reverse order to its initialization will not lead to any problems. It is no problem, when you have synthisized accessors, because they have noch side-effects.

No, this is not the case -- Ken's reply was correct. If you use automatic KVO notifications, your accessors will still have side effects. Again per Ken's reply, you should typically set instance variables directly in init methods, and release them directly in dealloc.

No, I think, that you should never, never have an observation, when - dealloc is running. *This* is the problem, not the KVO-Messages. If you are in -dealloc, the instance *will* be deleted. Since this happens running up the class hierarchy, the observing object has no chance to remove its observation before the object is deallocated. So in the moment of -dealloc (NSObject) you have an observation to an "dead object". *This* is the fault.

You always have to remove the observation before there is the chance of losing the object.
mmalc


Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to