tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 90bbcf290109367c1c85ecf8a456c8e7b5b95ca4
parent fe94eb63d22766c55f6d5441da83b2592c638799
Author: Andrew McCreight <continuation@gmail.com>
Date:   Wed, 19 Nov 2025 17:44:16 +0000

Bug 1840666 - Hold more ref pointers in MediaKeys::Shutdown(). r=media-playback-reviewers,aosmond

Differential Revision: https://phabricator.services.mozilla.com/D272096

Diffstat:
Mdom/media/eme/MediaKeys.cpp | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp @@ -189,9 +189,15 @@ void MediaKeys::Terminated() { } void MediaKeys::Shutdown() { + // Hold a self reference to keep us alive after we clear the self reference + // for each promise. This ensures we stay alive until we're done shutting + // down. + RefPtr<MediaKeys> selfReference = this; + EME_LOG("MediaKeys[%p]::Shutdown()", this); if (mProxy) { - mProxy->Shutdown(); + RefPtr<CDMProxy> proxy = mProxy; + proxy->Shutdown(); mProxy = nullptr; } @@ -201,11 +207,6 @@ void MediaKeys::Shutdown() { observerService->RemoveObserver(this, kMediaKeysResponseTopic); } - // Hold a self reference to keep us alive after we clear the self reference - // for each promise. This ensures we stay alive until we're done shutting - // down. - RefPtr<MediaKeys> selfReference = this; - for (const RefPtr<dom::DetailedPromise>& promise : mPromises.Values()) { promise->MaybeRejectWithInvalidStateError( "Promise still outstanding at MediaKeys shutdown");