Bug 1156472 - Part 14 - Null check the window, because it can be different during the window's shutdown. r=baku
authorPaul Adenot <paul@paul.cx>
Fri, 24 Jul 2015 14:28:17 +0200
changeset 286428 7d3b6dcae7fe1b7f81d155444af1b28070264f5a
parent 286427 4351b1e432dd4a412f705adbaf7afeab89d0ce25
child 286429 8541ce2730c063e3ed359a8f0212c7e6e1832594
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1156472
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1156472 - Part 14 - Null check the window, because it can be different during the window's shutdown. r=baku In which case everything is cleaned up properly by the HTMLMediaElement themselves.
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -557,16 +557,25 @@ AudioChannelService::RefreshAgentsCaptur
   aWindow->GetScriptableTop(getter_AddRefs(topWindow));
   nsCOMPtr<nsPIDOMWindow> pTopWindow = do_QueryInterface(topWindow);
   if (!pTopWindow) {
     return;
   }
 
   AudioChannelWindow* winData = GetWindowData(pTopWindow->WindowID());
 
+  // This can happen, but only during shutdown, because the the outer window
+  // changes ScriptableTop, so that its ID is different.
+  // In this case either we are capturing, and it's too late because the window
+  // has been closed anyways, or we are un-capturing, and everything has already
+  // been cleaned up by the HTMLMediaElements or the AudioContexts.
+  if (!winData) {
+    return;
+  }
+
   nsTObserverArray<AudioChannelAgent*>::ForwardIterator
     iter(winData->mAgents);
   while (iter.HasMore()) {
     iter.GetNext()->WindowAudioCaptureChanged(aInnerWindowID);
   }
 }
 
 /* static */ const nsAttrValue::EnumTable*