Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / speech / SpeechSynthesis.cpp
index 00b6009..d5b5608 100644 (file)
@@ -153,6 +153,10 @@ void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc
 {
     ASSERT(utterance);
 
+    // Keep the utterance around long enough to fire an event on it in case m_utteranceQueue
+    // is holding the last reference to it.
+    RefPtrWillBeRawPtr<SpeechSynthesisUtterance> protect(utterance);
+
     bool didJustFinishCurrentUtterance = false;
     // If the utterance that completed was the one we're currently speaking,
     // remove it from the queue and start speaking the next one.