• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[NSegmentedControl labelForSegment:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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


  • Prev by Date: Re: NSURLConnection issues
  • Next by Date: Diagramming (a bit OT)
  • Previous by thread: Re: NSURLConnection issues
  • Next by thread: Diagramming (a bit OT)
  • Index(es):
    • Date
    • Thread