Re: Checkboxes and NSBox titles
Re: Checkboxes and NSBox titles
- Subject: Re: Checkboxes and NSBox titles
- From: Fritz Anderson <email@hidden>
- Date: Tue, 12 Jun 2001 21:09:37 -0500
Begging pardon, but I thought one did
- (void) setMyVal: (id) newVal
{
[myVal autorelease];
myVal = [newVal retain];
}
... yes? Because those methods are no-ops when sent to nil, and
-retain always returns self? No need for conditionals, and no fear
of deallocating myVal if myVal==newVal?
-- F
At 4:41 PM -0700 6/12/2001, John C. Randolph wrote:
D'oh! you're right. that should be:
- (void) setTitleCell:(NSCell *) aCell
{
if (aCell && (_titleCell != aCell))
{
[_titleCell release];
[_aCell retain];
_titleCell = aCell;
}
}