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

Unified Diff: Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp

Issue 180553004: Fix use-after-free of m_currentSpeechUtterance. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix nullptr again? Created 6 years, 10 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 | « Source/modules/speech/testing/PlatformSpeechSynthesizerMock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp
diff --git a/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp b/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp
index 275925bd16920b63ab34c91b71d6dbe1b58d382c..093dd409a3d74907ebb39388b3941fae1fb402d9 100644
--- a/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp
+++ b/Source/modules/speech/testing/PlatformSpeechSynthesizerMock.cpp
@@ -42,12 +42,14 @@ PassOwnPtr<PlatformSpeechSynthesizerMock> PlatformSpeechSynthesizerMock::create(
PlatformSpeechSynthesizerMock::PlatformSpeechSynthesizerMock(PlatformSpeechSynthesizerClient* client)
: PlatformSpeechSynthesizer(client)
, m_speakingFinishedTimer(this, &PlatformSpeechSynthesizerMock::speakingFinished)
+ , m_speakingErrorOccurredTimer(this, &PlatformSpeechSynthesizerMock::speakingErrorOccurred)
{
}
PlatformSpeechSynthesizerMock::~PlatformSpeechSynthesizerMock()
{
m_speakingFinishedTimer.stop();
+ m_speakingErrorOccurredTimer.stop();
}
void PlatformSpeechSynthesizerMock::speakingFinished(Timer<PlatformSpeechSynthesizerMock>*)
@@ -57,6 +59,13 @@ void PlatformSpeechSynthesizerMock::speakingFinished(Timer<PlatformSpeechSynthes
m_utterance = nullptr;
}
+void PlatformSpeechSynthesizerMock::speakingErrorOccurred(Timer<PlatformSpeechSynthesizerMock>*)
+{
+ ASSERT(m_utterance.get());
+ client()->speakingErrorOccurred(m_utterance);
+ m_utterance = nullptr;
+}
+
void PlatformSpeechSynthesizerMock::initializeVoiceList()
{
m_voiceList.clear();
@@ -85,8 +94,7 @@ void PlatformSpeechSynthesizerMock::cancel()
return;
m_speakingFinishedTimer.stop();
- client()->speakingErrorOccurred(m_utterance);
- m_utterance = nullptr;
+ m_speakingErrorOccurredTimer.startOneShot(.1);
}
void PlatformSpeechSynthesizerMock::pause()
« no previous file with comments | « Source/modules/speech/testing/PlatformSpeechSynthesizerMock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698