Bug 1268233 - Don't unregister for audio session notifications if we haven't registered yet. r=aklotz a=lizzard
authorJim Mathies <jmathies@mozilla.com>
Wed, 27 Apr 2016 16:31:37 -0500
changeset 318618 2804f926fe774f845bc75a18262efabc3ca35fe8
parent 318617 9fa876867aa87b6fa322e53bb811173983bae067
child 318619 0162b3b3ee740c7a9dbcb05e7d8905034a38090f
push id9523
push userkwierso@gmail.com
push dateThu, 05 May 2016 18:02:25 +0000
treeherdermozilla-aurora@995ecc8dbf0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz, lizzard
bugs1268233
milestone48.0a2
Bug 1268233 - Don't unregister for audio session notifications if we haven't registered yet. r=aklotz a=lizzard MozReview-Commit-ID: JvUhjyoYzf6
widget/windows/AudioSession.cpp
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -291,20 +291,21 @@ AudioSession::Start()
   mState = STARTED;
 
   return NS_OK;
 }
 
 void
 AudioSession::StopInternal()
 {
-  if (mAudioSessionControl) {
+  if (mAudioSessionControl &&
+      (mState == STARTED || mState == STOPPED)) {
     mAudioSessionControl->UnregisterAudioSessionNotification(this);
-    mAudioSessionControl = nullptr;
   }
+  mAudioSessionControl = nullptr;
 }
 
 nsresult
 AudioSession::Stop()
 {
   MOZ_ASSERT(mState == STARTED ||
              mState == UNINITIALIZED || // XXXremove this
              mState == FAILED,