diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-31 20:47:37 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-31 20:47:37 +0000 |
commit | 5bc7b22f45aa6e8f1ddef056721876743c72a314 (patch) | |
tree | f4c75e2d3555dfff0c4f110b8a1a4e7668476284 /content/renderer/speech_recognition_dispatcher.cc | |
parent | ad627b1c012fc1199ca2a310c6b4213087e7a3f8 (diff) | |
download | chromium_src-5bc7b22f45aa6e8f1ddef056721876743c72a314.zip chromium_src-5bc7b22f45aa6e8f1ddef056721876743c72a314.tar.gz chromium_src-5bc7b22f45aa6e8f1ddef056721876743c72a314.tar.bz2 |
SpeechRecognitionDispatcher: delete handle before calling didEnd().
If the web page calls back synchronously from 'onend' and starts a new
session, we want the handle to be removed from the map *before* that
happens, not afterwards. Deleting it afterwards results in crashing.
BUG=155605
Review URL: https://chromiumcodereview.appspot.com/11275075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/speech_recognition_dispatcher.cc')
-rw-r--r-- | content/renderer/speech_recognition_dispatcher.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content/renderer/speech_recognition_dispatcher.cc b/content/renderer/speech_recognition_dispatcher.cc index 04495eb..f86b141 100644 --- a/content/renderer/speech_recognition_dispatcher.cc +++ b/content/renderer/speech_recognition_dispatcher.cc @@ -155,8 +155,12 @@ void SpeechRecognitionDispatcher::OnErrorOccurred( } void SpeechRecognitionDispatcher::OnRecognitionEnded(int request_id) { - recognizer_client_->didEnd(GetHandleFromID(request_id)); + WebSpeechRecognitionHandle handle = GetHandleFromID(request_id); + // Note: we need to erase the handle from the map *before* calling didEnd. + // didEnd may call back synchronously to start a new recognition session, + // and we don't want to delete the handle from the map after that happens. handle_map_.erase(request_id); + recognizer_client_->didEnd(handle); } void SpeechRecognitionDispatcher::OnResultRetrieved( |