Re: Crash in setTextColor
Re: Crash in setTextColor
- Subject: Re: Crash in setTextColor
- From: Steve Palmer <email@hidden>
- Date: Sun, 18 Apr 2004 18:27:24 -0700
Hmm... Yes. The way I was originally handling it was by saving the new
colour to the defaults, sending a notification from the preferences
controller to the main controller then reloading the colour from the
defaults overwriting the old object. Here's what I have now in the
notification handler:
NSData * colourData;
NSColor * newColour;
colourData = [[NSUserDefaults standardUserDefaults]
objectForKey:@"foobar"];
newColour = [[NSUnarchiver unarchiveObjectWith
Data:colourData] retain];
[myColour release];
myColour = newColour;
So the change is that each time I get a new colour from the defaults, I
retain it and release the old copy then pass myColour to setTextColor
in willDisplayCell. I've tested this and the crash has gone away but...
it would be nice to get some confirmation that I'm doing this
correctly. From reading the documentations on alloc, retain and release
I thought I was following the rules in the first place.
On Apr 18, 2004, at 9:45 AM, Ondra Cada wrote:
>
On 18.4.2004, at 18:31, Steve Palmer wrote:
>
>
> If newColor is one of the primary colours then everything works fine.
>
> If he selects a colour from the colour wheel rather than from the list
>
> of colours provided in the Apple group then it crashes...
>
>
Can't say for sure, but it looks like it gets released?
>
---
>
Ondra Hada
>
OCSoftware: email@hidden http://www.ocs.cz
>
private email@hidden http://www.ocs.cz/oc
>
>
[demime 0.98b removed an attachment of type
>
application/pkcs7-signature which had a name of smime.p7s]
>
_______________________________________________
>
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.
_______________________________________________
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.