Re: Problem with NSColor since 10.2
Re: Problem with NSColor since 10.2
- Subject: Re: Problem with NSColor since 10.2
- From: Ondra Cada <email@hidden>
- Date: Wed, 28 Aug 2002 15:28:10 +0200
On Wednesday, August 28, 2002, at 09:28 , Frank Blome wrote:
Another question on the new DevTools from Jaguar (they really drive me
crazy). These part of the source code has worked fine before I had
upgraded:
I defined in my .h:
...
NSData *allowColor;
...
-------------------
// While loading the Preferences I do:
...
allowColor = [defaults objectForKey: @"AllowColor"];
if (allowColor == nil)
allowColor = [NSArchiver archivedDataWithRootObject:[NSColor
blueColor]];
Suspicious: since allowColor is not an automatic variable, it seems you
should retain. (Also it would seem to be better to keep the NSColor
locally, not the archived NSData, but of course you might have strong
reasons for that.)
[colorWellAllow setColor:[NSUnarchiver
unarchiveObjectWithData:allowColor]];
...
-------------------
// When I'm saving the color, I do:
- (IBAction)setAllowColor:(id)sender
{
NSColor *color = [sender color];
allowColor = [NSArchiver archivedDataWithRootObject:color];
ditto
[[NSUserDefaults standardUserDefaults] setObject:allowColor forKey: @
"AllowColor"];
[self loadPreferences];
}
...
Anyone knows whats goin' on here? Have I done a general mistake, or is
the code OK?
Short of memory management, it looks right. What's the matter?
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.