Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 7259239

Browse files
committed
Bug 864858 - Hold a reference to utterance before nsSpeechTask goes away in DispatchEndImpl() r=smaug
1 parent ad6c092 commit 7259239

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

content/media/webspeech/synth/nsSpeechTask.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,16 @@ nsSpeechTask::DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex)
263263
mStream->Destroy();
264264
}
265265

266+
nsRefPtr<SpeechSynthesisUtterance> utterance = mUtterance;
267+
266268
if (mSpeechSynthesis) {
267269
mSpeechSynthesis->OnEnd(this);
268270
}
269271

270-
mUtterance->mState = SpeechSynthesisUtterance::STATE_ENDED;
271-
mUtterance->DispatchSpeechSynthesisEvent(NS_LITERAL_STRING("end"),
272-
aCharIndex, aElapsedTime,
273-
NS_LITERAL_STRING(""));
272+
utterance->mState = SpeechSynthesisUtterance::STATE_ENDED;
273+
utterance->DispatchSpeechSynthesisEvent(NS_LITERAL_STRING("end"),
274+
aCharIndex, aElapsedTime,
275+
NS_LITERAL_STRING(""));
274276
return NS_OK;
275277
}
276278

0 commit comments

Comments
 (0)