diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-02-16 15:52:34 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-02-16 15:21:40 +0000 |
commit | 9857c5186712da7b7be13404ca6369050decf9f1 (patch) | |
tree | 2e83f4d9732f3473d76a97666b81b6bafdce1a1f | |
parent | 5de7101be14e7711eae6d28d187709656bc6f51d (diff) |
QTextToSpeechEngineOsx - clear delegate in destructor
Apparently both our NSSpeechSynthesizer and its delegate can outlive
their C++ owner (QTextToSpeechEngineOsx); then delegate's callback
is using a dangling pointer. Found after an autotest crashed, on VM machines (CI)
that have no sound devices. Callback fires too late: test function
finished with BFAIL at this point and a stack-allocated QTextSpeech is already
dead.
Task-number: QTBUG-58786
Change-Id: I061cd2534e2010e5bac80546da0cf993a4409508
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | src/plugins/tts/osx/qtexttospeech_osx.mm | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/tts/osx/qtexttospeech_osx.mm b/src/plugins/tts/osx/qtexttospeech_osx.mm index 3c74115..7a56c58 100644 --- a/src/plugins/tts/osx/qtexttospeech_osx.mm +++ b/src/plugins/tts/osx/qtexttospeech_osx.mm @@ -70,6 +70,8 @@ QTextToSpeechEngineOsx::QTextToSpeechEngineOsx(const QVariantMap &/*parameters*/ QTextToSpeechEngineOsx::~QTextToSpeechEngineOsx() { + [speechSynthesizer setDelegate: nil]; + [speechSynthesizer stopSpeaking]; [speechSynthesizer release]; [stateDelegate release]; } |