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() MediaDecoderReader::~MediaDecoderReader()
{ {
MOZ_ASSERT(mShutdown); MOZ_ASSERT(mShutdown);
MOZ_ASSERT(!mDecoder);
ResetDecode(); ResetDecode();
MOZ_COUNT_DTOR(MediaDecoderReader); MOZ_COUNT_DTOR(MediaDecoderReader);
} }
@ -317,6 +318,8 @@ MediaDecoderReader::Shutdown()
p = ShutdownPromise::CreateAndResolve(true, __func__); p = ShutdownPromise::CreateAndResolve(true, __func__);
} }
mDecoder = nullptr;
return p; return p;
} }

View File

@ -61,6 +61,8 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
// The caller must ensure that Shutdown() is called before aDecoder is
// destroyed.
explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder); explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder);
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE // Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
@ -251,10 +253,6 @@ public:
return mTaskQueue; return mTaskQueue;
} }
void ClearDecoder() {
mDecoder = nullptr;
}
// Returns true if the reader implements RequestAudioData() // Returns true if the reader implements RequestAudioData()
// and RequestVideoData() asynchronously, rather than using the // and RequestVideoData() asynchronously, rather than using the
// implementation in this class to adapt the old synchronous to // 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 // so that it can't accidentally read it after the decoder
// is destroyed. // is destroyed.
mDecoder->GetReader()->Shutdown(); mDecoder->GetReader()->Shutdown();
mDecoder->GetReader()->ClearDecoder();
RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder); RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder);
mDecoder = nullptr; mDecoder = nullptr;
// task now holds the only ref to the decoder. // task now holds the only ref to the decoder.