Crash on quit

This commit is contained in:
Julien Wadel 2021-10-07 11:56:31 +02:00
parent 778a6abf86
commit 69a968b7af
3 changed files with 10 additions and 2 deletions

View file

@ -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;
}
// -----------------------------------------------------------------------------

View file

@ -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 {

View file

@ -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