Index: Source/modules/speech/SpeechSynthesis.cpp |
diff --git a/Source/modules/speech/SpeechSynthesis.cpp b/Source/modules/speech/SpeechSynthesis.cpp |
index 35560788f0929cb1f0307052ee753fe826cbc619..7393a91c45acddd9ad3dcbe6a786c66bc1c15119 100644 |
--- a/Source/modules/speech/SpeechSynthesis.cpp |
+++ b/Source/modules/speech/SpeechSynthesis.cpp |
@@ -34,9 +34,9 @@ |
namespace WebCore { |
-SpeechSynthesis* SpeechSynthesis::create(ExecutionContext* context) |
-{ |
- return adoptRefCountedGarbageCollected(new SpeechSynthesis(context)); |
+PassRefPtrWillBeRawPtr<SpeechSynthesis> SpeechSynthesis::create(ExecutionContext* context) |
+{ |
+ return adoptRefWillBeRefCountedGarbageCollected(new SpeechSynthesis(context)); |
} |
SpeechSynthesis::SpeechSynthesis(ExecutionContext* context) |
@@ -64,7 +64,7 @@ |
dispatchEvent(Event::create(EventTypeNames::voiceschanged)); |
} |
-const HeapVector<Member<SpeechSynthesisVoice> >& SpeechSynthesis::getVoices() |
+const WillBeHeapVector<RefPtrWillBeMember<SpeechSynthesisVoice> >& SpeechSynthesis::getVoices() |
{ |
if (m_voiceList.size()) |
return m_voiceList; |
@@ -152,6 +152,10 @@ |
void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred) |
{ |
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, |