• 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
NSAttributedString -size Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAttributedString -size Crash


  • Subject: NSAttributedString -size Crash
  • From: Seth Willits <email@hidden>
  • Date: Sun, 31 May 2009 15:36:01 -0700



For some reason that I have yet to discover, calling - [NSAttributedString size] is causing a crash. It's rare, but it's happening. I can't yet repeat it on my system.



Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000010

Thread 0 Crashed:
0 com.apple.CoreText 0x9532d56e CFTLine::CFTLine(__CFString const*, adopted_t const&) + 16
1 com.apple.CoreText 0x9530c2a3 CTTypesetterCreateLine + 129
2 com.apple.AppKit 0x95efbabc -[NSATSLineFragment layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect :] + 965
3 com.apple.AppKit 0x95efa539 -[NSATSTypesetter _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext :] + 2651
4 com.apple.AppKit 0x95f32e13 -[NSATSTypesetter layoutParagraphAtPoint:] + 155
5 com.apple.AppKit 0x95edb579 -[NSTypesetter _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex :] + 2974
6 com.apple.AppKit 0x964c8562 -[NSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] + 218
7 com.apple.AppKit 0x96243d98 -[NSATSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] + 599
8 com.apple.AppKit 0x95f309af - [NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 1024
9 com.apple.AppKit 0x95f47700 - [NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 261
10 com.apple.AppKit 0x95f3e9be _NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex + 624
11 com.apple.AppKit 0x95f3e569 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 128
12 com.apple.AppKit 0x95f3e400 -[NSLayoutManager glyphRangeForTextContainer:] + 307
13 com.apple.AppKit 0x95f6e433 - [NSStringDrawingTextStorage usedRectForTextContainer:] + 153
14 com.apple.AppKit 0x95eed172 - [NSAttributedString(NSExtendedStringDrawing) boundingRectWithSize:options:] + 2044
15 com.apple.AppKit 0x95fcfa5f - [NSAttributedString(NSStringDrawing) size] + 68
16 com.my.app 0x0007392c -[AQColumnTokenCell cellSize] + 46
17 com.my.app 0x00071cb9 -[AQColumnListView cellFrameForColumnIndex:] + 181
18 com.my.app 0x00072c07 -[AQColumnListView drawRect:] + 262
19 com.apple.AppKit 0x95f8529c -[NSView _drawRect:clip:] + 3853
20 com.apple.AppKit 0x95f83d93 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050
21 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
22 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
23 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
24 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
25 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
26 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
27 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
28 com.apple.AppKit 0x95f8412a -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
29 com.apple.AppKit 0x95f826e9 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 759
30 com.apple.AppKit 0x95f8202b -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView :] + 306
31 com.apple.AppKit 0x95f7eb4f -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3090
32 com.apple.AppKit 0x95ebf523 -[NSView displayIfNeeded] + 933
33 com.apple.AppKit 0x95f71c61 -[NSWindow _setFrameCommon:display:stashSize:] + 2031
34 com.apple.AppKit 0x95f7146a -[NSWindow setFrame:display:] + 78
35 com.apple.AppKit 0x95fc4469 -[NSMoveHelper _stopAnimation] + 637
36 com.apple.AppKit 0x96120776 -[NSMoveHelper _doAnimation] + 1048
37 com.apple.AppKit 0x9619f4b0 -[NSMoveHelper _resizeWindow:toFrame:display:] + 407
38 com.apple.AppKit 0x95fac71e -[NSWindow setFrame:display:animate:] + 1038
39 com.my.app 0x0006b1fa -[AQImportPanel(Private) p_displayColumnMappingView] + 1860
40 com.apple.AppKit 0x95f8e53b -[NSApplication sendAction:to:from:] + 112
41 com.apple.AppKit 0x95f8e478 -[NSControl sendAction:to:] + 108
42 com.apple.AppKit 0x95f8e2fe -[NSCell _sendActionFrom:] + 169
43 com.apple.AppKit 0x95f8d957 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1827
44 com.apple.AppKit 0x95f8d1aa -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 541
45 com.apple.AppKit 0x95f8ca64 -[NSControl mouseDown:] + 888
46 com.apple.AppKit 0x95f8b1a3 -[NSWindow sendEvent:] + 5381
47 com.apple.AppKit 0x95f57d49 -[NSApplication sendEvent:] + 2941
48 com.my.app 0x0009e9f4 -[AGApplication sendEvent:] + 445
49 com.apple.AppKit 0x95eb569f -[NSApplication run] + 847
50 com.apple.AppKit 0x95e828a4 NSApplicationMain + 574
51 com.my.app 0x0000306e start + 54




The relevant code is:


- (NSSize)cellSize; { NSAttributedString * attrStr = [self attributedStringValue]; NSSize size = [attrStr size]; size.width = ceil(size.width) + 3.0 + 16.0 + 16.0 + 3.0; return size; }



- (NSAttributedString *)attributedStringValue;
{
NSString * str = [self title];
NSMutableDictionary * attribs = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSFont systemFontOfSize:12.0], NSFontAttributeName, nil];

if ([str isEqual:@""]) {
str = @"none";
[attribs setObject:[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] forKey:NSForegroundColorAttributeName];
} else if ([self isHighlightedForReplacement]) {
[attribs setObject:[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] forKey:NSForegroundColorAttributeName];
}

return [[[NSAttributedString alloc] initWithString:str attributes:attribs] autorelease];
}




If [self title] were nil, I'd get an exception when creating the attributed string, not a crash when calling -size. There's nothing fancy going on with the string. The only thing I can think of is that this drawing and call to -size is happening while the window is resizing caused by a simple call to -[NSWindow setFrame:display:animate:].


Am I SOL?


-- Seth Willits



_______________________________________________

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


  • Follow-Ups:
    • Re: NSAttributedString -size Crash
      • From: Joar Wingfors <email@hidden>
    • Re: NSAttributedString -size Crash
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: [Moderator] Re: Nike+iPod Settings Undocumented?
  • Next by Date: Re: NSAttributedString -size Crash
  • Previous by thread: [Moderator] Re: Hidden API?
  • Next by thread: Re: NSAttributedString -size Crash
  • Index(es):
    • Date
    • Thread