Bug 790854. Keep MediaStream alive until MediaStream::Destroy ends. r=jesup

This commit is contained in:
Robert O'Callahan 2012-10-26 14:39:05 +13:00
parent 3651217462
commit 52d8418d94

View File

@ -1786,6 +1786,9 @@ MediaStream::DestroyImpl()
void
MediaStream::Destroy()
{
// Keep this stream alive until we leave this method
nsRefPtr<MediaStream> kungFuDeathGrip = this;
class Message : public ControlMessage {
public:
Message(MediaStream* aStream) : ControlMessage(aStream) {}
@ -1799,6 +1802,9 @@ MediaStream::Destroy()
};
mWrapper = nullptr;
GraphImpl()->AppendMessage(new Message(this));
// Message::RunDuringShutdown may have removed this stream from the graph,
// but our kungFuDeathGrip above will have kept this stream alive if
// necessary.
mMainThreadDestroyed = true;
}