зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1507093 - P2. Ensure that when returning from NotifyXPCOMShutdown we don't UAF. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D11858 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6561f5d257
Коммит
5f69f9479d
|
@ -349,16 +349,15 @@ void
|
|||
MediaDecoder::NotifyXPCOMShutdown()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// NotifyXPCOMShutdown will clear its reference to mDecoder. So we must ensure
|
||||
// that this MediaDecoder stays alive until completion.
|
||||
RefPtr<MediaDecoder> kungFuDeathGrip = this;
|
||||
if (auto owner = GetOwner()) {
|
||||
owner->NotifyXPCOMShutdown();
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsShutdown());
|
||||
|
||||
// Don't cause grief to release builds by ensuring Shutdown()
|
||||
// is always called during shutdown phase.
|
||||
if (!IsShutdown()) {
|
||||
} else if (!IsShutdown()) {
|
||||
Shutdown();
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsShutdown());
|
||||
}
|
||||
|
||||
MediaDecoder::~MediaDecoder()
|
||||
|
|
Загрузка…
Ссылка в новой задаче