Skip to content

Commit 47388e1

Browse files
committed
Bug 1993818 - Don't add battery observer after xpcom-will-shutdown. r=bradwerth
In bug 1981068 we made GPUProcessManager remove its battery observer in xpcom-will-shutdown rather than xpcom-shutdown, to ensure there are no outstanding observers when MacPowerInformationService shuts down in response to xpcom-shutdown. However, if the GPU process launch completes after xpcom-will-shutdown but before xpcom-shutdown, then we will create a new battery observer, causing the assertion that there are no outstanding observers during xpcom-shutdown to fail. This patch avoids this by checking the shutdown phase prior to creating the observer. Temporarily running without the observer is harmless, and the GPU process will be shutdown imminently anyway. Differential Revision: https://phabricator.services.mozilla.com/D272843 UltraBlame original commit: 4c3e758d1aecdef721408ab77bffb5c04e4314a8
1 parent bb048b7 commit 47388e1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

gfx/ipc/GPUProcessManager.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,13 +4079,29 @@ MOZ_DIAGNOSTIC_ASSERT
40794079
mBatteryObserver
40804080
)
40814081
;
4082+
if
4083+
(
4084+
!
4085+
AppShutdown
4086+
:
4087+
:
4088+
IsInOrBeyond
4089+
(
4090+
ShutdownPhase
4091+
:
4092+
:
4093+
XPCOMWillShutdown
4094+
)
4095+
)
4096+
{
40824097
mBatteryObserver
40834098
=
40844099
new
40854100
BatteryObserver
40864101
(
40874102
)
40884103
;
4104+
}
40894105
/
40904106
/
40914107
Flush

0 commit comments

Comments
 (0)