Bug 1247514 - Clear speech delegate when finishing speaking. r=eeejay
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 03 Mar 2016 11:14:01 +0900
changeset 287012 4b9a16cc88c2e2689dc2c9c47be8fc01ea5439da
parent 287011 e0fd2136c897db4951017586f87090bd8315122e
child 287013 68d3781deda0d4d58ec9877862830db89669b3a5
child 287083 c254f951e0ad68f047763f8e2c2fa9385b74a798
push id18032
push usercbook@mozilla.com
push dateMon, 07 Mar 2016 10:38:51 +0000
treeherderfx-team@087905ffec78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1247514
milestone47.0a1
Bug 1247514 - Clear speech delegate when finishing speaking. r=eeejay After dispatched didFinishSpeaking by OS, another events may be dispatched. So I should remove speech delegate soon when didFinishSpeaking is called. MozReview-Commit-ID: nsHKJCX8MQ
dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
--- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
+++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
@@ -146,16 +146,17 @@ SpeechTaskCallback::OnError(uint32_t aIn
   mTask->DispatchError(GetTimeDurationFromStart(), aIndex);
 }
 
 void
 SpeechTaskCallback::OnDidFinishSpeaking()
 {
   mTask->DispatchEnd(GetTimeDurationFromStart(), mCurrentIndex);
   // no longer needed
+  [mSpeechSynthesizer setDelegate:nil];
   mTask = nullptr;
 }
 
 @interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate>
 {
 @private
   SpeechTaskCallback* mCallback;
 }