• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAttributedString crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString crashes


  • Subject: Re: NSAttributedString crashes
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 03 Mar 2011 16:54:16 -0800

On Mar 3, 2011, at 4:35 PM, Kyle Sluder wrote:

> On Thu, Mar 3, 2011 at 4:20 PM, Gerriet M. Denkmann
> <email@hidden> wrote:
>> But, taking my original example:
>>
>> NSAttributedString * attributedString = ...
>> NSFont *aFont = [ attributedString attribute: NSFontAttributeName  atIndex: 0  effectiveRange: NULL ];
>> NSString *fontName = [aFont fontName];
>> [ attributedString release ];
>>
>> Now aFont no longer exists.
>> So fontName, being a property of the no longer existing aFont, should have vanished also, shouldn't it?
>
> Replace "should" with "could." The point is that there's no guarantee,
> and you need to be prepared for the case where it does.
>

And anyway the argument, as specifically posed, is specious, because NSString is a very, very special case. Memory management for strings is utterly different from memory management for a normal object. Most strings are way over-retained and *never* vanish. Indeed, it is quite difficult to generate a string that *does* vanish if no one retains it. You can do it, but you have to hunt around for a while to figure out how. So arguing by analogy with what an NSString does cuts no ice whatever.

Having said all of that, the OP should feel free to file a bug. I've recently filed about a memory leak in connection with NSMutableAttributedString, and have had this acknowledged as a known issue. So the idea that there might be something a bit funny with memory management in connection with NSAttributedString is not unreasonable. m.

_______________________________________________

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

  • Follow-Ups:
    • Re: NSAttributedString crashes
      • From: Graham Cox <email@hidden>
References: 
 >Re: NSAttributedString crashes (From: Matt Neuburg <email@hidden>)
 >Re: NSAttributedString crashes (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSAttributedString crashes (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: NSAttributedString crashes
  • Next by Date: Re: Setting a delegate on a UITextField
  • Previous by thread: Re: NSAttributedString crashes
  • Next by thread: Re: NSAttributedString crashes
  • Index(es):
    • Date
    • Thread