WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
209145
[Cocoa] Crash under -[WKPreferenceObserver init]
https://bugs.webkit.org/show_bug.cgi?id=209145
Summary
[Cocoa] Crash under -[WKPreferenceObserver init]
Per Arne Vollan
Reported
2020-03-16 11:47:58 PDT
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;
Attachments
Patch
(1.77 KB, patch)
2020-03-16 11:57 PDT
,
Per Arne Vollan
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Per Arne Vollan
Comment 1
2020-03-16 11:48:15 PDT
rdar://problem/60470713
Per Arne Vollan
Comment 2
2020-03-16 11:57:32 PDT
Created
attachment 393667
[details]
Patch
Darin Adler
Comment 3
2020-03-16 12:45:01 PDT
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.
Per Arne Vollan
Comment 4
2020-03-16 13:12:02 PDT
(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!
Per Arne Vollan
Comment 5
2020-03-16 13:13:07 PDT
Committed
r258515
: <
https://trac.webkit.org/changeset/258515/webkit
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug