Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Fixes hang waiting for cancelled TextToSpeech #1895

Merged
merged 2 commits into from
Jan 18, 2022

Conversation

borigas
Copy link
Contributor

@borigas borigas commented Oct 6, 2021

Description of Change

There's a bug in Android TTS that if you cancel quickly after starting TTS, SpeakAsync will never return. This is because the CancellationToken was cancelled before the TaskCompletionSource was being assigned, so awaiting the TaskCompletionSource would wait forever. To fix, I moved the creation of the TaskCompletionSource before we register with the CancellationToken

Bugs Fixed

Provide links to issues here. Ensure that a GitHub issue was created for your feature or bug fix before sending PR.

API Changes

None

Behavioral Changes

Describe any non-bug related behavioral changes that may change how users app behaves when upgrading to this version of the codebase.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@borigas
Copy link
Contributor Author

borigas commented Oct 6, 2021

I don't think build failures were related to my changes. Let me know if I'm wrong

@jamesmontemagno jamesmontemagno added this to the 1.7.1 milestone Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Android TextToSpeech.SpeakAsync() hangs if cancelled immediately
3 participants