Bug 1415556 - P5. Use helper to set mDriver. r?padenot draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 10 Nov 2017 18:28:42 +0100
changeset 696752 7925479fd30a430459feecfb98dee4d1e723948e
parent 696751 129c1bb2eb3f7e5df024f32d73cbd5217bf7e32e
child 696753 79db6cec9548275d14012ba7d112a72ba44a5756
push id88781
push userbmo:jyavenard@mozilla.com
push dateSat, 11 Nov 2017 09:23:59 +0000
reviewerspadenot
bugs1415556
milestone58.0a1
Bug 1415556 - P5. Use helper to set mDriver. r?padenot MozReview-Commit-ID: Fres1YwcYYM
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1608,17 +1608,20 @@ public:
 
     // Release the driver now so that an AudioCallbackDriver will release its
     // SharedThreadPool reference.  Each SharedThreadPool reference must be
     // released before SharedThreadPool::SpinUntilEmpty() runs on
     // xpcom-shutdown-threads.  Don't wait for GC/CC to release references to
     // objects owning streams, or for expiration of mGraph->mShutdownTimer,
     // which won't otherwise release its reference on the graph until
     // nsTimerImpl::Shutdown(), which runs after xpcom-shutdown-threads.
-    mGraph->mDriver = nullptr;
+    {
+      MonitorAutoLock mon(mGraph->mMonitor);
+      mGraph->SetCurrentDriver(nullptr);
+    }
 
     // Safe to access these without the monitor since the graph isn't running.
     // We may be one of several graphs. Drop ticket to eventually unblock shutdown.
     if (mGraph->mShutdownTimer && !mGraph->mForceShutdownTicket) {
       MOZ_ASSERT(false,
         "AudioCallbackDriver took too long to shut down and we let shutdown"
         " continue - freezing and leaking");