Index: Source/modules/webaudio/AsyncAudioDecoder.cpp |
diff --git a/Source/modules/webaudio/AsyncAudioDecoder.cpp b/Source/modules/webaudio/AsyncAudioDecoder.cpp |
index 95a56a2904ec9bc6cf034d93a75c91e6faab18d5..6bde9d67aa5ad86306449f42e5b72338f3fdeee4 100644 |
--- a/Source/modules/webaudio/AsyncAudioDecoder.cpp |
+++ b/Source/modules/webaudio/AsyncAudioDecoder.cpp |
@@ -54,8 +54,11 @@ void AsyncAudioDecoder::decodeAsync(ArrayBuffer* audioData, float sampleRate, Pa |
if (!audioData) |
return; |
+ // Add a ref to keep audioData alive until completion of decoding. |
+ RefPtr<ArrayBuffer> audioDataRef(audioData); |
+ |
// The leak references to successCallback and errorCallback are picked up on notifyComplete. |
- m_thread->postTask(new Task(WTF::bind(&AsyncAudioDecoder::decode, audioData, sampleRate, successCallback.leakRef(), errorCallback.leakRef()))); |
+ m_thread->postTask(new Task(WTF::bind(&AsyncAudioDecoder::decode, audioDataRef.release().leakRef(), sampleRate, successCallback.leakRef(), errorCallback.leakRef()))); |
} |
void AsyncAudioDecoder::decode(ArrayBuffer* audioData, float sampleRate, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback) |