Bug 1399395 - skip devicechange event handler in shutdown stage. r=pehrsons
authorMunro Mengjue Chiang <mchiang@mozilla.com>
Thu, 14 Sep 2017 11:16:42 +0800
changeset 430409 ec3c4234c98a424000d0e4312463b02ed7ec1516
parent 430408 45a470fd009745f4048e3ed39bc698b9f0784031
child 430410 291700116d62b23439ce9733b1d2f97733db8d1e
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1399395
milestone57.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 1399395 - skip devicechange event handler in shutdown stage. r=pehrsons MozReview-Commit-ID: 8skWP7LuGvR
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2055,16 +2055,19 @@ StopRawIDCallback(MediaManager *aThis,
   aListener->StopRawID(*removedDeviceID);
 }
 
 
 void MediaManager::OnDeviceChange() {
   RefPtr<MediaManager> self(this);
   NS_DispatchToMainThread(media::NewRunnableFrom([self]() mutable {
     MOZ_ASSERT(NS_IsMainThread());
+    if (sInShutdown) {
+      return NS_OK;
+    }
     self->DeviceChangeCallback::OnDeviceChange();
 
     // On some Windows machine, if we call EnumertaeRawDevices immediately after receiving
     // devicechange event, sometimes we would get outdated devices list.
     PR_Sleep(PR_MillisecondsToInterval(100));
     RefPtr<PledgeSourceSet> p = self->EnumerateRawDevices(0, MediaSourceEnum::Camera, MediaSourceEnum::Microphone, false);
     p->Then([self](SourceSet*& aDevices) mutable {
       UniquePtr<SourceSet> devices(aDevices);