Bug 1515873 - Don't create a backend as part of cleanup. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 03 Jan 2019 04:21:09 +0000
changeset 509478 3de35d7cda2d61b703eb0a9eecff0893901d682d
parent 509477 ef22d23a09a8f1b18669fd48389a9fb20e999e98
child 509479 4f844b2ebd4fc15c3d9ebe688e96d109e019cb7f
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1515873
milestone66.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 1515873 - Don't create a backend as part of cleanup. r=jib 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
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -3399,17 +3399,19 @@ void MediaManager::OnNavigation(uint64_t
     RemoveWindowID(aWindowID);
   }
   MOZ_ASSERT(!GetWindowListener(aWindowID));
 
   RemoveMediaDevicesCallback(aWindowID);
 
   MediaManager::PostTask(
       NewTaskFrom([self = RefPtr<MediaManager>(this), 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);
     MOZ_ASSERT(mediadevices);