TTS: Resolve segfault when exiting scummvm

This commit is contained in:
Jaromir Wysoglad 2019-07-11 22:53:58 +02:00 committed by Filippos Karapetis
parent 39e74b027e
commit 8c44b03231
3 changed files with 4 additions and 2 deletions

View File

@ -87,7 +87,7 @@ LinuxTextToSpeechManager::LinuxTextToSpeechManager()
}
LinuxTextToSpeechManager::~LinuxTextToSpeechManager() {
spd_close(_connection);
//spd_close(_connection);
}
void LinuxTextToSpeechManager::updateState(LinuxTextToSpeechManager::SpeechState state) {

View File

@ -38,6 +38,9 @@ TextToSpeechManager::~TextToSpeechManager() {
TTSState *tmp = _ttsState;
while (tmp != nullptr) {
tmp = _ttsState->_next;
for (TTSVoice *i = _ttsState->_availaibleVoices.begin(); i < _ttsState->_availaibleVoices.end(); i++) {
free(i->_data);
}
delete _ttsState;
_ttsState = tmp;
}

View File

@ -48,7 +48,6 @@ class TTSVoice {
TTSVoice(Gender gender, void *data)
: _gender(gender)
, _data(data) {}
~TTSVoice() { debug("%d", * (int *)_data); if (_data != nullptr) free(_data); }
Gender getGender() { return _gender; };
void setGender(Gender gender) { _gender = gender; };
void setData(void *data) { _data = data; };