Closed Bug 1398357 Opened 2 years ago Closed 2 years ago

LocaleService destructor fails to correctly remove its preference observers

Categories

(Core :: Internationalization, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: kmag, Assigned: kmag)

Details

Attachments

(2 files)

At the time its destructor is called, sInstance has already been cleared, which means a null pointer gets passed to Preferences::RemoveObservers. In fact, it's not even possible for this RemoveObservers call to be valid in the LocaleService destructor, since it registers strong observers, which keep the object alive as long as they're registered.
Comment on attachment 8906129 [details]
Bug 1398357: Part 1 - Fix removal of LocaleService preference observers.

Thank you Kris!

I think I tried using weak observer first but couldn't get it to work (bug 1344445 comment 11).
Attachment #8906129 - Flags: review?(gandalf) → review+
Comment on attachment 8906130 [details]
Bug 1398357: Part 2 - Assert that Preferences methods observer/callback args are never null.

https://reviewboard.mozilla.org/r/177870/#review182958
Attachment #8906130 - Flags: review?(n.nethercote) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/4c33f18d2e96220b721d4a6c593e39939a13a99a
Bug 1398357: Part 1 - Fix removal of LocaleService preference observers. r=gandalf

https://hg.mozilla.org/integration/mozilla-inbound/rev/d59f7e89c0884cb430520b6bb136cc880fd3375d
Bug 1398357: Part 2 - Assert that Preferences methods observer/callback args are never null. r=njn
https://hg.mozilla.org/mozilla-central/rev/4c33f18d2e96
https://hg.mozilla.org/mozilla-central/rev/d59f7e89c088
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.