Bug 790854. Set mMainThreadDestroyed before the stream is destroyed. r=jesup
☠☠ backed out by 988a9fdc1294 ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 26 Oct 2012 11:07:59 +1300
changeset 111586 15c4d6334107a7874e84e248440fd057e148381f
parent 111584 04602cf8bff7e0a0c930fd299a933d5eb110ace8
child 111587 72e6fd5a0358dd70c6267a10bf89d5538d34adb2
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjesup
bugs790854
milestone19.0a1
Bug 790854. Set mMainThreadDestroyed before the stream is destroyed. r=jesup
content/media/MediaStreamGraph.cpp
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -1793,18 +1793,19 @@ MediaStream::Destroy()
     {
       mStream->DestroyImpl();
       mStream->GraphImpl()->RemoveStream(mStream);
     }
     virtual void RunDuringShutdown()
     { Run(); }
   };
   mWrapper = nullptr;
+  mMainThreadDestroyed = true;
   GraphImpl()->AppendMessage(new Message(this));
-  mMainThreadDestroyed = true;
+  // 'this' can be dead after the AppendMessage, so don't touch it here.
 }
 
 void
 MediaStream::AddAudioOutput(void* aKey)
 {
   class Message : public ControlMessage {
   public:
     Message(MediaStream* aStream, void* aKey) : ControlMessage(aStream), mKey(aKey) {}