Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: Source/modules/speech/SpeechSynthesis.cpp

Issue 228133002: Fix crash if utterance is garbage-collected before speech ends. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comment Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/speechsynthesis/speech-synthesis-gc-utterance-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/speech/SpeechSynthesis.cpp
diff --git a/Source/modules/speech/SpeechSynthesis.cpp b/Source/modules/speech/SpeechSynthesis.cpp
index 00b60091d8d97ef02dbd8da2764236da39ca1907..d5b5608d6e26ef6985239cf939dd9b99d8a532b8 100644
--- a/Source/modules/speech/SpeechSynthesis.cpp
+++ b/Source/modules/speech/SpeechSynthesis.cpp
@@ -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.
« no previous file with comments | « LayoutTests/fast/speechsynthesis/speech-synthesis-gc-utterance-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698