mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Windows: Read Aloud: Fix an occasional crash when stopping read aloud when using the legacy windows TTS backend. Fixes #2080705 [Download read aloud api failed](https://bugs.launchpad.net/calibre/+bug/2080705)
This commit is contained in:
parent
c07c662a5a
commit
df7344be33
@ -38,6 +38,16 @@ class QtTTSBackend(TTSBackend):
|
|||||||
self.tts.resume()
|
self.tts.resume()
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
|
if self.tts.engine() == 'sapi' and self.tts.state() is QTextToSpeech.State.Speaking:
|
||||||
|
# prevent an occasional crash on stop by re-creating the engine rather than stopping it
|
||||||
|
self.tts.sayingWord.disconnect()
|
||||||
|
self.tts.stateChanged.disconnect()
|
||||||
|
self.tts.pause()
|
||||||
|
self.tts.deleteLater()
|
||||||
|
del self.tts
|
||||||
|
self._qt_reload_after_configure('sapi')
|
||||||
|
self._state_changed(QTextToSpeech.State.Ready)
|
||||||
|
else:
|
||||||
self.tts.stop()
|
self.tts.stop()
|
||||||
|
|
||||||
def say(self, text: str) -> None:
|
def say(self, text: str) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user