Hi,

I'm running into an odd crasher on PowerPC machines.  I have a custom
NSView called TYCurrentDayView that draws an nsmutableattributedstring
on top of a gradient.   On a few instances, I will receive the
following crash:


Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000001f
Crashed Thread:  0

Application Specific Information:
objc[24283]: garbage collection is ON

Thread 0 Crashed:
0   libobjc.A.dylib                     0xfffeff18 objc_msgSend_rtp + 24
1   com.apple.AppKit                    0x93d33c3c -[NSATSGlyphStorage
setGlyphRange:characterRange:] + 2424
2   com.apple.AppKit                    0x93d331b4 -[NSATSTypesetter
_ctTypesetter] + 276
3   com.apple.AppKit                    0x93d324f0 -[NSATSLineFragment
layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:]
+ 92
4   com.apple.AppKit                    0x93d316d0 -[NSATSTypesetter
_layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:]
+ 1916
5   com.apple.AppKit                    0x93d30b18 -[NSSingleLineTypesetter
createRenderingContextForCharacterRange:typesetterBehavior:usesScreenFonts:hasStrongRight:maximumWidth:]
+ 388
6   com.apple.AppKit                    0x93d81b38
__NSCreateRenderingContextForAttributedString + 288
7   com.apple.AppKit                    0x93d25680
-[NSAttributedString(NSExtendedStringDrawing)
boundingRectWithSize:options:] + 1052
8   com.apple.AppKit                    0x93df067c
-[NSAttributedString(NSStringDrawing) size] + 52
9   com.secondgear.today                0x00008054 -[TYCurrentDayView
drawRect:] + 900
10  com.apple.AppKit                    0x93dad044 -[NSView _drawRect:clip:] + 
2908
11  com.apple.AppKit                    0x93dac02c -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 844
12  com.apple.AppKit                    0x93dac2d0 -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1520

(Full Trace at http://secondgearllc.com/attachments/42208crasher.txt)

The code itself that looks to be causing the issue is:

NSMutableAttributedString *todaysDate = [[NSMutableAttributedString
alloc] init];
NSMutableAttributedString *datePrefix = [[NSMutableAttributedString
alloc] initWithString:NSLocalizedString(@"Today is ", @"Today Is
String")];
NSMutableAttributedString *actualDate = [[NSMutableAttributedString
alloc] initWithString:[NSString stringWithFormat:@"%@", [dateFormatter
stringFromDate:self.currentDay]]];

[todaysDate appendAttributedString:datePrefix];
[todaysDate appendAttributedString:actualDate];

NSRange fullDateRange = NSMakeRange(0, todaysDate.length);
NSRange dateOnlyRange = NSMakeRange(9,
todaysDate.length-datePrefix.length); // The amount of chars in "Today
is "

[todaysDate beginEditing];
[todaysDate addAttribute:NSFontAttributeName value:[NSFont
fontWithName:@"Lucida Grande" size:16.0] range:fullDateRange];
[todaysDate addAttribute:NSFontAttributeName value:[NSFont
fontWithName:@"Lucida Grande Bold" size:16.0] range:dateOnlyRange];
[todaysDate addAttribute:NSForegroundColorAttributeName value:[NSColor
whiteColor] range:fullDateRange];
[todaysDate addAttribute:NSKernAttributeName value:[NSNumber
numberWithFloat:0.5] range:fullDateRange];
[todaysDate endEditing];

I've never been able to reproduce it on any Intel machines, but it
happens about 10-20% of the time on PowerPC Macs.

Any help would be appreciated.

-
Justin Williams
[EMAIL PROTECTED]
http://secondgearllc.com/
-
Check out Today: iCal's new best friend <http://secondgearllc.com/today/>-
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to