NSColorWell setColor crash FIXED ?
NSColorWell setColor crash FIXED ?
- Subject: NSColorWell setColor crash FIXED ?
- From: "Mark's Studio" <email@hidden>
- Date: Thu, 6 Sep 2001 11:45:40 +0200
I've changed a few things first i added the "colorUsingColorSpaceName:"
didn't help on the original problem but is it needed?
[myColorWell setColor:[[aGroup groupColor]
colorUsingColorSpaceName:@"NSCalibratedRGBColorSpace"]];
Then i could not save my file so i changed the setGroupColor in Group
class,
and now it works, but if i add a new group and quit without saving i
sometimes get a 10 SIGBUS error.
do i need to release the color? and why is it only sometimes i get the
10 SIGBUS error.
- (void)setGroupColor:(NSColor *)color
{
[groupColor autorelease];
// groupColor = color; what it used to be
groupColor =[color copyWithZone:[self zone]];
}
Original Post.
I have a window with a colorwell ,a tableview , a textfield, a Add and a
Edit button.
I can add an item to a MutableArray of Group (a NSString and a NSColor)
taking the string from textfield and the color from the colorwell,
and if i select something in the tableview the textfield and colorwell
shows whats stored in the Group.
But if i change the color in the colorpanel and change selection in the
tableview
without first pressing the Add or Edit button it Crashes.
-[NSConcreteValue drawSwatchInRect:]: selector not recognized
What am i doing wrong?
is it something to do with the continuous state of the colorwell, and my
setColor makes the exception
(Pause just trying!!)
no difference, maybe it's not working the colorpanel still updates the
colorwell continuous,
unless continuous works differently.
- (IBAction)addNewGroup:(id)sender
{
Group *aGroup = [[Group alloc]init];
[GroupDB addObject:aGroup];
[aGroup setGroupName:[editGroupName stringValue]];
[aGroup setGroupColor:[myColorWell color]];
}
- (IBAction)editGroup:(id)sender
{
Group *aGroup = [[Group alloc]init];
int index = [GroupEditView selectedRow];
[GroupDB replaceObjectAtIndex:index withObject:aGroup];
[GroupEditView reloadData];
[GroupView reloadData];
[aGroup setGroupName:[editGroupName stringValue]];
[aGroup setGroupColor:[myColorWell color]];
}
- (IBAction)selectedInEditGroupView:(id)sender
{
Group *aGroup;
int index = [GroupEditView selectedRow];
if(index > -1 && index <=[GroupDB count]){
aGroup = [GroupDB objectAtIndex:index];
NSLog(@"Selectedcolor(%@)",(NSColor *)[aGroup groupColor]);
[editGroupName setStringValue:[aGroup groupName]];
[myColorWell setColor:(NSColor *)[aGroup groupColor]];
}
}
Peter Mark
Mark's Recording Studio A/S
Faelledvej 19 b DK2200 N
Copenhagen Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden