diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 2e48dbc16669a13987440d2e97cb0348afc033dd..9725a54c41a4eeeec63b21f703a3d22f844c21e7 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -56,16 +56,14 @@ GAudioOutput::GAudioOutput(QObject *parent) : worker->moveToThread(thread); connect(this, &GAudioOutput::textToSpeak, worker, &QGCAudioWorker::say); connect(this, &GAudioOutput::beepOnce, worker, &QGCAudioWorker::beep); + connect(thread, &QThread::finished, thread, &QObject::deleteLater); + connect(thread, &QThread::finished, worker, &QObject::deleteLater); thread->start(); } GAudioOutput::~GAudioOutput() { thread->quit(); - thread->wait(); - - delete worker; - delete thread; }