nsPrefBranch should unregister itself as observer when shutting down
Categories
(Core :: Preferences: Backend, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox67 | --- | fixed |
People
(Reporter: baku, Assigned: baku)
Details
Attachments
(2 files)
nsPrefBranch unregisters itself as observer in the DTOR:
But this could be too late in case the nsObserverService has been already in the shutting down phase. Here is why:
-
nsObserverService is released on shutdown because of this:
https://searchfox.org/mozilla-central/rev/92d11a33250a8e368c8ca3e962e15ca67117f765/xpcom/build/XPCOMInit.cpp#685-688 -
nsPermissionManager is released by ClearOnShutdown, and that happens here:
https://searchfox.org/mozilla-central/source/xpcom/build/XPCOMInit.cpp#691-695 -
releasing nsPermissionManager we release nsPrefBranch which calls nsObserverService in its dtor. Here is the crash: https://searchfox.org/mozilla-central/rev/92d11a33250a8e368c8ca3e962e15ca67117f765/xpcom/ds/nsObserverService.cpp#177-181
The correct fix is to remove the observer when xpcom-shutdown is notified.
At the same time, nsObserverService should be less aggressive and allow the removeObserver() when mShuttingDown is set to true.
| Assignee | ||
Comment 1•7 years ago
|
||
| Assignee | ||
Comment 2•7 years ago
|
||
Depends on D22086
Comment 4•7 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/35f5d2d519eb
https://hg.mozilla.org/mozilla-central/rev/8c835f11c111
Updated•7 years ago
|
Description
•