diff --git a/OSBindings/Qt/functionthread.h b/OSBindings/Qt/functionthread.h index 759338277..9510b9063 100644 --- a/OSBindings/Qt/functionthread.h +++ b/OSBindings/Qt/functionthread.h @@ -25,8 +25,9 @@ class FunctionThread: public QThread { } void stop() { - QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection); - while(isRunning()); +// QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection); + quit(); + wait(); } private: diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 18f6b292e..21a2e0b76 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -65,7 +65,7 @@ void MainWindow::open() { MainWindow::~MainWindow() { // Stop the audio output, and its thread. if(audioOutput) { - audioOutput->stop(); +// QMetaObject::invokeMethod(audioOutput.get(), "stop", Qt::BlockingQueuedConnection); audioThread.stop(); } diff --git a/OSBindings/Qt/timer.cpp b/OSBindings/Qt/timer.cpp index 9c9a0fa25..9dd6d38ef 100644 --- a/OSBindings/Qt/timer.cpp +++ b/OSBindings/Qt/timer.cpp @@ -13,7 +13,7 @@ Timer::Timer(QObject *parent) : QObject(parent) { timer = std::make_unique(); timer->setInterval(1); - connect(timer.get(), SIGNAL(timeout()), this, SLOT(tick()), Qt::DirectConnection); + connect(timer.get(), &QTimer::timeout, this, &Timer::tick, Qt::DirectConnection); timer->start(); }); } @@ -35,6 +35,6 @@ void Timer::tick() { } Timer::~Timer() { - QMetaObject::invokeMethod(timer.get(), "stop", Qt::QueuedConnection); + QMetaObject::invokeMethod(timer.get(), "stop", Qt::BlockingQueuedConnection); thread.stop(); }