Summary: | [Cocoa] Crash under -[WKPreferenceObserver init] | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Per Arne Vollan <pvollan> | ||||
Component: | WebKit Misc. | Assignee: | Per Arne Vollan <pvollan> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | bfulgham, darin, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=209765 | ||||||
Attachments: |
|
Description
Per Arne Vollan
2020-03-16 11:47:58 PDT
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> |