macOS Big Sur 11.0 crash on [paragraphStyle setParagraphStyle: [NSParagraphStyle defaultParagraphStyle]];

Originator:rossetantoine
Number:rdar://FB8930278 Date Originated:6 dec 2020
Status:Open Resolved:
Product:macOS API Product Version:11.0, 11.0.1, 11.1,
Classification:Crash Apple API Reproducible:Yes
 
Immediate crash with exception when calling these lines (macOS 11.0.1 & macOS 11.1) :

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setParagraphStyle:[NSParagraphStyle defaultParagraphStyle]];

It occurs on all Intel Apple computers.
It doesn’t affect M1 Apple computers.

Comments

macOS Preference: __NSDisableSharingTextTabInstance

After some more investigations, it seems related to a preference created by macOS (“__NSDisableSharingTextTabInstance”):

int main(int argc, const char *argv[]) {

[[NSUserDefaults standardUserDefaults] setBool: YES forKey: @"__NSDisableSharingTextTabInstance"]; // -> What is it? Created by old version of macOS ???

// Uncomment this line to make it works !
//[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"__NSDisableSharingTextTabInstance"];

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];


// It crashes here, if __NSDisableSharingTextTabInstance was YES
[paragraphStyle setParagraphStyle:[NSParagraphStyle defaultParagraphStyle]];

return NSApplicationMain(argc, argv);

}

By rossetantoine at Dec. 12, 2020, 9 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!