Re: NSAttributedString crashes
Re: NSAttributedString crashes
- Subject: Re: NSAttributedString crashes
- From: Kyle Sluder <email@hidden>
- Date: Tue, 01 Mar 2011 01:19:15 -0800
On Tue, Mar 1, 2011 at 1:15 AM, Gerriet M. Denkmann
<email@hidden> wrote:
> As far as I can see, this article talks about different ways to implement setters and getters.
> Do you want to imply that, whenever I get some object from AppKit, I have to retain it until I no longer need it?
You got the font from an accessor on the attributed string. You
released the attributed string. Therefore, your reference to the font
might no longer be valid. This is what Option 3 describes.
>
> Would be a safe thing to do. But also tedious. And in all my past experience this was never necessary.
Probably because you either didn't explicitly release the object whose
accessor you called (you autoreleased it or never had an owning
reference), or the accessor covered your butt.
> So I thought that the "Technique 1" of the linked article (returning [[someObject retain] autorelease]) was the standart practice employed by AppKit.
Nope, otherwise there'd be no sense in documenting the others. They'd
just document the one they used and tell you to do the same.
--Kyle Sluder
_______________________________________________
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