On Sat, Jan 23, 2010 at 1:48 AM, vincent habchi <[email protected]> wrote:
> The problem is that when the represented object is removed from the array 
> controller, the corresponding NSView is not immediately released. Instead, 
> there is an implied CAAnimation (or something similar) that makes the NSView 
> slowly fade away. Net result is that the NSView survives some tenths of a 
> second after the represented object is released, and the KVO unregistering 
> crashes.

Hooray for retain cycles; if you avoid them you get overrelease bugs!
(I can't wait for garbage collection.)

This happens a lot in any non-trivial context. You might want to have
some sort of notification or delegate method that keeps your object
alive long enough. Putting code after calling [super dealloc] is
usually a bad idea, because self will be a garbage pointer, and how
many of us are so careful about pointer lifetimes that we're immune to
writing use-after-free bugs, especially when we return to the code six
months later?

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

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