Post

Replies

Boosts

Views

Activity

Reply to Crash on Sequoia 15.2
// Create the text field NSTextField* textField = [[NSTextField alloc] initWithFrame:NSMakeRect(x, y, width, height)]; // Use the system font using the standard size textField.font = [NSFont labelFontOfSize:[NSFont systemFontSize]]; textField.textColor = [NSColor textColor]; [textField setStatic]; [textField setID:idControl]; [textField setText:szText]; // <== crash in this function @implementation NSTextField(NSTextFieldAdditions) (void) setStatic { self.alignment = NSLeftTextAlignment; self.bordered = NO; self.drawsBackground = NO; self.bezeled = NO; self.editable = NO; self.selectable = NO; } (void) setText:(const tchar*)szText { // If an input control then use the unstyled text. If a static control then use the attributed text if ((self.isEditable) || (self.isSelectable) || (self.drawsBackground)) { // <== Always take this path which should not happen self.stringValue = [NSString stringWithUTF8String:szText]; } else { NSMutableAttributedString* attrStringMutable = [[[NSMutableAttributedString alloc] initWithString:nszText attributes:attrDic] autorelease]; self.attributedStringValue = attrStringMutable; }
2w
Reply to Crash on Sequoia 15.2
Sorry for bad formatting of the code. The crash is not reproduced on my Mac. It is produced on customer machines. It frequency is low but if it produced on a particular Mac it always consistently produced on that Mac. So I think it is hardware dependent.
2w
Reply to Crash on Sequoia 15.2
Sharing the code snippet. As per the following code, -setText should not set property self.stringValue. Instead it should set self.attributedStringValue. But the crash log we see that crash occurs inside call to setStringValue // Create the text field NSTextField* textField = [[NSTextField alloc] initWithFrame:NSMakeRect(x, y, width, height)]; // Use the system font using the standard size textField.font = [NSFont labelFontOfSize:[NSFont systemFontSize]]; textField.textColor = [NSColor textColor]; [textField setStatic]; [textField setID:idControl]; [textField setText:szText]; @implementation NSTextField(NSTextFieldAdditions) (void) setStatic { self.alignment = NSLeftTextAlignment; self.bordered = NO; self.drawsBackground = NO; self.bezeled = NO; self.editable = NO; self.selectable = NO; } (void) setText:(const tchar*)szText { LFTRACE("Text:", szText); // If an input control then use the unstyled text. If a static control then use the attributed text if ((self.isEditable) || (self.isSelectable) || (self.drawsBackground)) { self.stringValue = [NSString stringWithUTF8String:szText]; } else { NSMutableAttributedString* attrStringMutable = [[[NSMutableAttributedString alloc] initWithString:nszText attributes:attrDic] autorelease]; self.attributedStringValue = attrStringMutable; }
2w