Bug 793294 follow-up: Hold on to JS objects early in AudioBuffer::InitializeBuffers
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 26 Sep 2012 11:52:01 -0400
changeset 108149 29fe3da0ea11d3c6a050fc6fdf2e1a1fd4c17bd7
parent 108148 6351566e60838680b216e7b3bdbd970904ed9fbd
child 108150 5ebf745a3a40d1c489fab9fe95ad65fef8d18daf
push id23539
push userryanvm@gmail.com
push dateWed, 26 Sep 2012 22:55:55 +0000
treeherderautoland@ec079fd92224 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs793294
milestone18.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 793294 follow-up: Hold on to JS objects early in AudioBuffer::InitializeBuffers
content/media/webaudio/AudioBuffer.cpp
--- a/content/media/webaudio/AudioBuffer.cpp
+++ b/content/media/webaudio/AudioBuffer.cpp
@@ -57,29 +57,29 @@ AudioBuffer::~AudioBuffer()
   if (mChannels.Length()) {
     NS_DROP_JS_OBJECTS(this, AudioBuffer);
   }
 }
 
 bool
 AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext)
 {
+  NS_HOLD_JS_OBJECTS(this, AudioBuffer);
+
   if (!mChannels.SetCapacity(aNumberOfChannels)) {
     return false;
   }
   for (uint32_t i = 0; i < aNumberOfChannels; ++i) {
     JSObject* array = JS_NewFloat32Array(aJSContext, mLength);
     if (!array) {
       return false;
     }
     mChannels.AppendElement(array);
   }
 
-  NS_HOLD_JS_OBJECTS(this, AudioBuffer);
-
   return true;
 }
 
 JSObject*
 AudioBuffer::WrapObject(JSContext* aCx, JSObject* aScope,
                         bool* aTriedToWrap)
 {
   return AudioBufferBinding::Wrap(aCx, aScope, this, aTriedToWrap);