mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 868741 - Fix a null-pointer crash in ProcessPriorityManager. r=bent
This crash would occur if a ParticularProcessPriorityManager observed a wake-lock change after being ShutDown().
This commit is contained in:
parent
7e63d3b77e
commit
0ef86009b8
@ -482,12 +482,25 @@ ParticularProcessPriorityManager::Init()
|
||||
ParticularProcessPriorityManager::~ParticularProcessPriorityManager()
|
||||
{
|
||||
LOGP("Destroying ParticularProcessPriorityManager.");
|
||||
UnregisterWakeLockObserver(this);
|
||||
|
||||
// Unregister our wake lock observer if ShutDown hasn't been called. (The
|
||||
// wake lock observer takes raw refs, so we don't want to take chances here!)
|
||||
// We don't call UnregisterWakeLockObserver unconditionally because the code
|
||||
// will print a warning if it's called unnecessarily.
|
||||
|
||||
if (mContentParent) {
|
||||
UnregisterWakeLockObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
ParticularProcessPriorityManager::Notify(const WakeLockInformation& aInfo)
|
||||
{
|
||||
if (!mContentParent) {
|
||||
// We've been shut down.
|
||||
return;
|
||||
}
|
||||
|
||||
bool* dest = nullptr;
|
||||
if (aInfo.topic().EqualsLiteral("cpu")) {
|
||||
dest = &mHoldsCPUWakeLock;
|
||||
@ -805,6 +818,8 @@ ParticularProcessPriorityManager::ShutDown()
|
||||
{
|
||||
MOZ_ASSERT(mContentParent);
|
||||
|
||||
UnregisterWakeLockObserver(this);
|
||||
|
||||
if (mResetPriorityTimer) {
|
||||
mResetPriorityTimer->Cancel();
|
||||
mResetPriorityTimer = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user