A crash has been observed on line 206 in PreferenceObserver.mm: 204 for (auto domain : domains) { 205 auto userDefaults = adoptNS([[WKUserDefaults alloc] initWithSuiteName:domain]); -> 206 userDefaults.get()->m_observer = self;
rdar://problem/60470713
Created attachment 393667 [details] Patch
Comment on attachment 393667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393667&action=review > Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm:206 > - auto userDefaults = adoptNS([[WKUserDefaults alloc] initWithSuiteName:domain]); > + auto userDefaults = adoptNS([WKUserDefaults alloc]); > + if (![userDefaults initWithSuiteName:domain]) { This is the wrong way to write it. Leave the code as is and write it like this: auto userDefaults = adoptNS([[WKUserDefaults alloc] initWithSuiteName:domain]); if (!userDefaults) { The adoptNS function already handles everything correctly.
(In reply to Darin Adler from comment #3) > Comment on attachment 393667 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393667&action=review > > > Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm:206 > > - auto userDefaults = adoptNS([[WKUserDefaults alloc] initWithSuiteName:domain]); > > + auto userDefaults = adoptNS([WKUserDefaults alloc]); > > + if (![userDefaults initWithSuiteName:domain]) { > > This is the wrong way to write it. Leave the code as is and write it like > this: > > auto userDefaults = adoptNS([[WKUserDefaults alloc] > initWithSuiteName:domain]); > if (!userDefaults) { > > The adoptNS function already handles everything correctly. Fixed. Thanks for reviewing!
Committed r258515: <https://trac.webkit.org/changeset/258515/webkit>