Bug 1515873 - Don't create a backend as part of cleanup. r=jib, a=RyanVM
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 03 Jan 2019 04:21:09 +0000
changeset 506527 2641666a95ba71d2fad2fcfd48bd13f8f6f0adef
parent 506526 ab6723fb0cefb88a1325ebca507dafa15e6e479a
child 506528 8da001054d078428a9a356caa00ce93957075aa3
push id10448
push userryanvm@gmail.com
push dateFri, 04 Jan 2019 19:56:55 +0000
treeherdermozilla-beta@8da001054d07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, RyanVM
Bug 1515873 - Don't create a backend as part of cleanup. r=jib, a=RyanVM There's no guarantee a backend exists when a MediaManager does, and crash-stats shows that shutdown can occur between posting a task and running it, making it illegal to create a backend anew. We're safer off avoiding creating a new backend. The cleanup step we're trying to do is only effective if a backend already exists anyway. Differential Revision: https://phabricator.services.mozilla.com/D15631
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -3316,17 +3316,19 @@ void MediaManager::OnNavigation(uint64_t
   RefPtr<MediaManager> self = this;
   MediaManager::PostTask(NewTaskFrom([self, aWindowID]() {
-    self->GetBackend()->ReleaseResourcesForWindow(aWindowID);
+    if (self->mBackend) {
+      self->mBackend->ReleaseResourcesForWindow(aWindowID);
+    }
 void MediaManager::RemoveMediaDevicesCallback(uint64_t aWindowID) {
   MutexAutoLock lock(mCallbackMutex);
   for (DeviceChangeCallback* observer : mDeviceChangeCallbackList) {
     dom::MediaDevices* mediadevices = static_cast<dom::MediaDevices*>(observer);