Bug 1220646 - don't access mOwner which is invalid after shutdown. r=kinetik. a=ritu
authorJW Wang <jwwang@mozilla.com>
Tue, 03 Nov 2015 20:26:57 +0800
changeset 305891 3bb6c2232c8d9890510f794cec0160b604e7afbf
parent 305890 24692f1a19390593f823d3056805fa3988c29457
child 305892 2d1e997196dba011d393beb006dd466038bdee06
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, ritu
bugs1220646
milestone44.0
Bug 1220646 - don't access mOwner which is invalid after shutdown. r=kinetik. a=ritu
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -740,16 +740,19 @@ MediaDecoder::NotifyDecodeError()
   AbstractThread::MainThread()->Dispatch(r.forget());
 }
 
 void
 MediaDecoder::NotifyDataEnded(nsresult aStatus)
 {
   RefPtr<MediaDecoder> self = this;
   nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
+    if (self->mShuttingDown) {
+      return;
+    }
     self->NotifyDownloadEnded(aStatus);
     if (NS_SUCCEEDED(aStatus)) {
       HTMLMediaElement* element = self->mOwner->GetMediaElement();
       if (element) {
         element->DownloadSuspended();
       }
       // NotifySuspendedStatusChanged will tell the element that download
       // has been suspended "by the cache", which is true since we never