bug 1095251 clear mDecoder on reader during Shutdown() r=cpearce

This commit is contained in:
Karl Tomlinson 2015-02-10 15:50:02 +13:00
parent e099cead5d
commit a93e73597b
3 changed files with 5 additions and 5 deletions

View File

@ -86,6 +86,7 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
MediaDecoderReader::~MediaDecoderReader()
{
MOZ_ASSERT(mShutdown);
MOZ_ASSERT(!mDecoder);
ResetDecode();
MOZ_COUNT_DTOR(MediaDecoderReader);
}
@ -317,6 +318,8 @@ MediaDecoderReader::Shutdown()
p = ShutdownPromise::CreateAndResolve(true, __func__);
}
mDecoder = nullptr;
return p;
}

View File

@ -61,6 +61,8 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
// The caller must ensure that Shutdown() is called before aDecoder is
// destroyed.
explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder);
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
@ -251,10 +253,6 @@ public:
return mTaskQueue;
}
void ClearDecoder() {
mDecoder = nullptr;
}
// Returns true if the reader implements RequestAudioData()
// and RequestVideoData() asynchronously, rather than using the
// implementation in this class to adapt the old synchronous to

View File

@ -849,7 +849,6 @@ public:
// so that it can't accidentally read it after the decoder
// is destroyed.
mDecoder->GetReader()->Shutdown();
mDecoder->GetReader()->ClearDecoder();
RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder);
mDecoder = nullptr;
// task now holds the only ref to the decoder.