diff options
author | Bastien Bouclet | 2019-11-15 21:24:22 +0100 |
---|---|---|
committer | Bastien Bouclet | 2019-11-15 21:24:22 +0100 |
commit | 34bf3f2de0e2722f8a6e951e8fb5be069ba7299f (patch) | |
tree | 3d59490a3dcb2c2d467d0f7ccf24b25dee6503db /common/text-to-speech.cpp | |
parent | c87ca97b2252999f3edb326cfd7a22fc639fbb64 (diff) | |
download | scummvm-rg350-34bf3f2de0e2722f8a6e951e8fb5be069ba7299f.tar.gz scummvm-rg350-34bf3f2de0e2722f8a6e951e8fb5be069ba7299f.tar.bz2 scummvm-rg350-34bf3f2de0e2722f8a6e951e8fb5be069ba7299f.zip |
TTS: Fix use of virtual function in TTSMan destructor
TextToSpeechManager::freeVoiceData was called while the virtual function
table pointer was already reset by the parent class destructor.
Diffstat (limited to 'common/text-to-speech.cpp')
-rw-r--r-- | common/text-to-speech.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/text-to-speech.cpp b/common/text-to-speech.cpp index fa74e53c36..8e4742b3e9 100644 --- a/common/text-to-speech.cpp +++ b/common/text-to-speech.cpp @@ -88,15 +88,6 @@ TextToSpeechManager::TextToSpeechManager() { _ttsState->_next = nullptr; } -TextToSpeechManager::~TextToSpeechManager() { - TTSState *tmp = _ttsState; - while (tmp != nullptr) { - tmp = _ttsState->_next; - delete _ttsState; - _ttsState = tmp; - } -} - void TextToSpeechManager::pushState() { stop(); TTSState *newState = new TTSState; @@ -130,6 +121,15 @@ bool TextToSpeechManager::popState() { return false; } +void TextToSpeechManager::clearState() { + TTSState *tmp = _ttsState; + while (tmp != nullptr) { + tmp = _ttsState->_next; + delete _ttsState; + _ttsState = tmp; + } +} + TTSVoice TextToSpeechManager::getVoice() { if (!_ttsState->_availableVoices.empty()) return _ttsState->_availableVoices[_ttsState->_activeVoice]; |