Re: NSAttributedString crashes

2011-03-04 Thread Corbin Dunn
On Mar 1, 2011, at 12:45 AM, Gerriet M. Denkmann wrote: > NSMutableAttributedString *attributedString = [ [ NSMutableAttributedString > alloc ] initWithString: firstChar ]; > [ attributedString fixFontAttributeInRange: NSMakeRange(0,[ attributedString > length ]) ]; > NSFont *aFont = [ attribu

Re: NSAttributedString crashes

2011-03-03 Thread Andy Lee
On Mar 3, 2011, at 1:10 PM, Matt Neuburg wrote: > So what I'm trying to show you is that when you've got an object that owns > stuff, you *never* expect that that object will dispense the stuff it owns > while handing you a share in ownership. I would argue it's irrelevant whether the dispensin

Re: NSAttributedString crashes

2011-03-03 Thread Matt Neuburg
On Mar 3, 2011, at 7:32 PM, Graham Cox wrote: > On 04/03/2011, at 11:54 AM, Matt Neuburg wrote: > >> because NSString is a very, very special case. Memory management for strings >> is utterly different from memory management for a normal object > > > Is it? > > Are you basing this on your ob

Re: NSAttributedString crashes

2011-03-03 Thread Graham Cox
On 04/03/2011, at 11:54 AM, Matt Neuburg wrote: > because NSString is a very, very special case. Memory management for strings > is utterly different from memory management for a normal object Is it? Are you basing this on your observations, or on some documentation? I don't see this though

Re: NSAttributedString crashes

2011-03-03 Thread Matt Neuburg
On Mar 3, 2011, at 4:35 PM, Kyle Sluder wrote: > On Thu, Mar 3, 2011 at 4:20 PM, Gerriet M. Denkmann > wrote: >> But, taking my original example: >> >> NSAttributedString * attributedString = ... >> NSFont *aFont = [ attributedString attribute: NSFontAttributeName atIndex: >> 0 effectiveRang

Re: NSAttributedString crashes

2011-03-03 Thread Kyle Sluder
On Thu, Mar 3, 2011 at 4:20 PM, Gerriet M. Denkmann wrote: > But, taking my original example: > > NSAttributedString * attributedString = ... > NSFont *aFont = [ attributedString attribute: NSFontAttributeName  atIndex: 0 >  effectiveRange: NULL ]; > NSString *fontName = [aFont fontName]; > [ att

Re: NSAttributedString crashes

2011-03-03 Thread Gerriet M. Denkmann
On 4 Mar 2011, at 01:10, Matt Neuburg wrote: > On Tue, 01 Mar 2011 16:15:09 +0700, "Gerriet M. Denkmann" > said: >> >> On 1 Mar 2011, at 15:53, Kyle Sluder wrote: >> >>> On Tue, Mar 1, 2011 at 12:45 AM, Gerriet M. Denkmann >>> wrote: So obviously NSAttributedString does NOT return [ [ a

Re: NSAttributedString crashes

2011-03-03 Thread Quincey Morris
On Mar 3, 2011, at 10:10, Matt Neuburg wrote: > What you *can* rely on is that a ***factory method*** will hand you an > autoreleased object. So, [NSArray array] hands you an autoreleased array; it > won't vanish right this second, but it will vanish when your code comes to an > end, unless you

Re: NSAttributedString crashes

2011-03-03 Thread Matt Neuburg
On Tue, 01 Mar 2011 16:15:09 +0700, "Gerriet M. Denkmann" said: > >On 1 Mar 2011, at 15:53, Kyle Sluder wrote: > >> On Tue, Mar 1, 2011 at 12:45 AM, Gerriet M. Denkmann >> wrote: >>> So obviously NSAttributedString does NOT return [ [ aFont retain ] >>> autorelease ] but just some internal poin

Re: NSAttributedString crashes

2011-03-01 Thread Kyle Sluder
On Tue, Mar 1, 2011 at 1:15 AM, Gerriet M. Denkmann 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 fr

Re: NSAttributedString crashes

2011-03-01 Thread Gerriet M. Denkmann
On 1 Mar 2011, at 15:53, Kyle Sluder wrote: > On Tue, Mar 1, 2011 at 12:45 AM, Gerriet M. Denkmann > wrote: >> So obviously NSAttributedString does NOT return [ [ aFont retain ] >> autorelease ] but just some internal pointer. >> >> Is this documented somewhere? > > In the Memory Management P

Re: NSAttributedString crashes

2011-03-01 Thread Kyle Sluder
On Tue, Mar 1, 2011 at 12:45 AM, Gerriet M. Denkmann wrote: > So obviously NSAttributedString does NOT return [ [ aFont retain ] > autorelease ] but just some internal pointer. > > Is this documented somewhere? In the Memory Management Programming Guide: http://developer.apple.com/library/mac/#d