bug 1198656 clear references in mJSChannels on successful content acquire r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 24 Aug 2015 15:06:43 +1200
changeset 294337 d325ca7fa94cccbd0a3f30ce7bf5c22618a7054d
parent 294336 5376e4042cf34a8845250397d670275e9e000cc4
child 294338 e4fb01e4e3cd2eed2668c0efc85c35f8a8d42224
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1198656
milestone43.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 1198656 clear references in mJSChannels on successful content acquire r=padenot The array buffers are no longer available and mJSChannels will be overwritten in RestoreJSChannelData() before it is used again. This is consistent with "Attach ArrayBuffers containing copies of the data to the AudioBuffer, to be returned by the next call to getChannelData."
dom/media/webaudio/AudioBuffer.cpp
--- a/dom/media/webaudio/AudioBuffer.cpp
+++ b/dom/media/webaudio/AudioBuffer.cpp
@@ -248,16 +248,21 @@ AudioBuffer::StealJSArrayDataIntoSharedC
       : nullptr;
     if (stolenData) {
       result->SetData(i, stolenData, js_free, stolenData);
     } else {
       NS_ASSERTION(i == 0, "some channels lost when contents not acquired");
       return nullptr;
     }
   }
+
+  for (uint32_t i = 0; i < mJSChannels.Length(); ++i) {
+    mJSChannels[i] = nullptr;
+  }
+
   return result.forget();
 }
 
 ThreadSharedFloatArrayBufferList*
 AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext)
 {
   if (!mSharedChannels) {
     mSharedChannels = StealJSArrayDataIntoSharedChannels(aJSContext);