From 69a968b7af958ab98314e3285474b29e35486221 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 7 Oct 2021 11:56:31 +0200 Subject: [PATCH] Crash on quit --- linphone-app/src/app/App.cpp | 6 ++++-- .../src/components/other/text-to-speech/TextToSpeech.cpp | 5 +++++ .../src/components/other/text-to-speech/TextToSpeech.hpp | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index 1eea44294..b12e64b20 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -242,8 +242,10 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U App::~App () { qInfo() << QStringLiteral("Destroying app..."); - delete mEngine; - delete mParser; + if( mEngine ) + mEngine->deleteLater();// Let to Qt the time to delete its data + if( mParser) + delete mParser; } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/other/text-to-speech/TextToSpeech.cpp b/linphone-app/src/components/other/text-to-speech/TextToSpeech.cpp index 22e37a1d7..b38c58629 100644 --- a/linphone-app/src/components/other/text-to-speech/TextToSpeech.cpp +++ b/linphone-app/src/components/other/text-to-speech/TextToSpeech.cpp @@ -34,6 +34,9 @@ TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) { mQtTextToSpeech = new QTextToSpeech(this); connect(mQtTextToSpeech, &QTextToSpeech::stateChanged, this, &TextToSpeech::onStateChanged); } +TextToSpeech::~TextToSpeech(){ + mQtTextToSpeech->deleteLater(); +} void TextToSpeech::say (const QString &text) { if(mQtTextToSpeech->volume() == 0.0) @@ -56,6 +59,8 @@ void TextToSpeech::onStateChanged(QTextToSpeech::State state){ #else TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {} +TextToSpeech::~TextToSpeech(){} + void TextToSpeech::say (const QString &) {} bool TextToSpeech::available () const { diff --git a/linphone-app/src/components/other/text-to-speech/TextToSpeech.hpp b/linphone-app/src/components/other/text-to-speech/TextToSpeech.hpp index 9ad42d511..3c820cfe9 100644 --- a/linphone-app/src/components/other/text-to-speech/TextToSpeech.hpp +++ b/linphone-app/src/components/other/text-to-speech/TextToSpeech.hpp @@ -37,6 +37,7 @@ class TextToSpeech : public QObject { public: TextToSpeech (QObject *parent = Q_NULLPTR); + ~TextToSpeech(); Q_INVOKABLE void say (const QString &text); #ifdef TEXTTOSPEECH_ENABLED