FROM : Shawn Erickson
DATE : Mon Aug 28 20:42:41 2006
On 8/28/06, Alan Smith <<email_removed>> wrote:
> Here is the code where the color is retained:
>
> - (void)setHighlightColor:(NSColor*)color
Try something like the following (I personally use the first of the
three and I believe Apple recommends it as well)...
- (void)setHighlightColor:(NSColor*)color
{
if (color != highlightColor) {
[highlightColor release];
highlightColor = [color retain]; //or copy if what you get
could possibly be mutable
}
}
...or...
- (void)setHighlightColor:(NSColor*)color
{
[highlightColor autorelease];
highlightColor = [color retain]; //or copy if what you get could
possibly be mutable
}
...or...
- (void)setHighlightColor:(NSColor*)color
{
NSColor* original = highlightColor;
highlightColor = [color retain]; //or copy if what you get could
possibly be mutable
[original release];
}
DATE : Mon Aug 28 20:42:41 2006
On 8/28/06, Alan Smith <<email_removed>> wrote:
> Here is the code where the color is retained:
>
> - (void)setHighlightColor:(NSColor*)color
Try something like the following (I personally use the first of the
three and I believe Apple recommends it as well)...
- (void)setHighlightColor:(NSColor*)color
{
if (color != highlightColor) {
[highlightColor release];
highlightColor = [color retain]; //or copy if what you get
could possibly be mutable
}
}
...or...
- (void)setHighlightColor:(NSColor*)color
{
[highlightColor autorelease];
highlightColor = [color retain]; //or copy if what you get could
possibly be mutable
}
...or...
- (void)setHighlightColor:(NSColor*)color
{
NSColor* original = highlightColor;
highlightColor = [color retain]; //or copy if what you get could
possibly be mutable
[original release];
}






Cocoa mail archive

