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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to