Bug 1592539 - Also null out mMediaStreamRenderer in Unlink. r=bryce

I have observed async calls to the MediaStreamRenderer's mWatchManager::Unwatch()
in flight after it was Shutdown(). This would cause an assertion failure in
debug. Per the comment we should do the same in Unlink as
EndSrcMediaStreamPlayback() without creating new strong refs. This conforms to
that instruction.

I am not willing to null out the other members at this point, since at least
HTMLVideoElement's relies on the selected video track to exist in some cases.

Differential Revision: https://phabricator.services.mozilla.com/D87136
This commit is contained in:
Andreas Pehrson
2020-08-26 14:25:08 +00:00
parent 580236ee61
commit cc22d15799

View File

@@ -2004,6 +2004,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement,
}
if (tmp->mMediaStreamRenderer) {
tmp->mMediaStreamRenderer->Shutdown();
// We null out mMediaStreamRenderer here since Shutdown() will shut down
// its WatchManager, and UpdateSrcStreamPotentiallyPlaying() contains a
// guard for this.
tmp->mMediaStreamRenderer = nullptr;
}
if (tmp->mMediaStreamTrackListener) {
tmp->mSrcStream->UnregisterTrackListener(