[NSegmentedControl labelForSegment:]
[NSegmentedControl labelForSegment:]
- Subject: [NSegmentedControl labelForSegment:]
- From: Stephen Blinkhorn <email@hidden>
- Date: Thu, 30 Jul 2009 20:54:46 -0600
Hello and advanced apologies if I'm doing something stupid here but..
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:[style tabFont] forKey:NSFontAttributeName];
[attributes setObject:[style frame1Color]
forKey:NSForegroundColorAttributeName];
NSString *label = [self labelForSegment:i];
NSSize labelSize = [label sizeWithAttributes:attributes];
int x_pos = (segWidth - labelSize.width) / 2;
NSRect labelRect = NSOffsetRect(segRect, x_pos, 0);
[label drawInRect:labelRect withAttributes:attributes];
The code above is crashing my app when it quits with a "incorrect
checksum for freed object - object was probably modified after being
freed".
If I comment out the [label drawInRect:..] then no crash.
If I do NSString *label = @"TestString" then no crash.
Can anyone shed any light on this? This code is from a subclass of
NSSegmentedControl.
Thanks,
Stephen
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden