Bug 848954 - Part 19 - Delete the mixer callbacks on removal. r=roc
authorPaul Adenot <paul@paul.cx>
Tue, 26 Aug 2014 17:02:09 +0200
changeset 223509 256f26db10f176dbac842fbabeb8f7a84786fe3e
parent 223508 f8bb3bcc38eb767620d7ba19decb1c0f173e4cb3
child 223510 8bc52009e325ea4fa90ec585277d57f9c1b97f5a
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs848954
milestone34.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 848954 - Part 19 - Delete the mixer callbacks on removal. r=roc
content/media/AudioMixer.h
--- a/content/media/AudioMixer.h
+++ b/content/media/AudioMixer.h
@@ -39,17 +39,20 @@ public:
   AudioMixer()
     : mFrames(0),
       mChannels(0),
       mSampleRate(0)
   { }
 
   ~AudioMixer()
   {
-    mCallbacks.clear();
+    MixerCallback* cb;
+    while ((cb = mCallbacks.popFirst())) {
+      delete cb;
+    }
   }
 
   void StartMixing()
   {
     mSampleRate = mChannels = mFrames = 0;
   }
 
   /* Get the data from the mixer. This is supposed to be called when all the
@@ -103,16 +106,17 @@ public:
     return false;
   }
 
   bool RemoveCallback(MixerCallbackReceiver* aReceiver) {
     for (MixerCallback* cb = mCallbacks.getFirst();
          cb != nullptr; cb = cb->getNext()) {
       if (cb->mReceiver == aReceiver) {
         cb->remove();
+        delete cb;
         return true;
       }
     }
     return false;
   }
 private:
   void EnsureCapacityAndSilence() {
     if (mFrames * mChannels > mMixedAudio.Length()) {