• 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: Checkboxes and NSBox titles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checkboxes and NSBox titles


  • Subject: Re: Checkboxes and NSBox titles
  • From: John Hörnkvist <email@hidden>
  • Date: Wed, 13 Jun 2001 01:39:22 +0200

On Tuesday, June 12, 2001, at 11:42 PM, John C. Randolph wrote:

- (void) setTitleCell:(NSCell *) aCell
{
if (aCell && (_titleCell != aCell))
[_titleCell release];
[_aCell retain];
_titleCell = aCell;
}

aCell==_tileCell; would cause a memory leak, wouldn't it?

I'd just reverse the order of the retain and release;
- (void) setTitleCell:(NSCell *) aCell
{
[aCell retain]; // Retain aCell first; its good practice
[_titleCell release];
_titleCell = aCell;
}

(Well, maybe one should protect against aCell==nil, in case there are unguarded [_titleCell size] calls and such in there. Otherwise I think one should be able to set the cell to nil...)

- (void) setTitleCell:(NSCell *) aCell
{
if (aCell && (_titleCell != aCell))
{
[aCell retain]; // Retain aCell first; its good practice
[_titleCell release];
_titleCell = aCell;
}
}

Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


  • Follow-Ups:
    • Re: Checkboxes and NSBox titles
      • From: "John C. Randolph" <email@hidden>
References: 
 >Re: Checkboxes and NSBox titles (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: Curse you, PDF!
  • Next by Date: Getting select click
  • Previous by thread: Re: Checkboxes and NSBox titles
  • Next by thread: Re: Checkboxes and NSBox titles
  • Index(es):
    • Date
    • Thread