Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
- Subject: Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
- From: Andy Lee <email@hidden>
- Date: Thu, 20 Jan 2011 22:20:06 -0500
On Jan 20, 2011, at 9:39 PM, Corbin Dunn wrote:
> Now for something like a button, it obviously won't run into this type of latent drawing issue, since they don't message the delegate every time they draw. However, if you temporarily allocated an object and set it as the target/action of a button, and then free that object while the button is still visible, then yes, that's a case where you want to reset it to nil.
I don't know why I had it in my mind that targets are retained. If they were, they'd run into the same retain cycles as delegates would if *they* were retained.
I think it would be going to extremes to nil out button targets in dealloc. I think a common-sense approach is best after all, and I retracted the bug I mentioned earlier because checking delegates for == self should be up to the discretion of the programmer. Can't hurt to do it, but it almost certainly won't matter.
--Andy
_______________________________________________
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