From b1ce69fb2be82780c9fec0fbdb0a8d595316c850 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 20 Sep 2022 21:13:12 +0100 Subject: [PATCH] Call stopWork from destructor. --- plugins/feature/aprs/aprs.cpp | 2 +- plugins/feature/aprs/aprsworker.cpp | 2 +- plugins/feature/gs232controller/gs232controller.cpp | 2 +- plugins/feature/gs232controller/gs232controllerworker.cpp | 2 +- plugins/feature/pertester/pertester.cpp | 2 +- plugins/feature/pertester/pertesterworker.cpp | 2 +- plugins/feature/satellitetracker/satellitetracker.cpp | 2 +- plugins/feature/startracker/startracker.cpp | 2 +- plugins/feature/startracker/startrackerworker.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/feature/aprs/aprs.cpp b/plugins/feature/aprs/aprs.cpp index 33b2aa292..1e00f0c0f 100644 --- a/plugins/feature/aprs/aprs.cpp +++ b/plugins/feature/aprs/aprs.cpp @@ -89,7 +89,7 @@ APRS::~APRS() void APRS::start() { qDebug("APRS::start"); - m_thread = new QThread(this); + m_thread = new QThread(); m_worker = new APRSWorker(this, m_webAPIAdapterInterface); m_worker->moveToThread(m_thread); diff --git a/plugins/feature/aprs/aprsworker.cpp b/plugins/feature/aprs/aprsworker.cpp index 2ee0125c8..d28c38d55 100644 --- a/plugins/feature/aprs/aprsworker.cpp +++ b/plugins/feature/aprs/aprsworker.cpp @@ -51,6 +51,7 @@ APRSWorker::APRSWorker(APRS *aprs, WebAPIAdapterInterface *webAPIAdapterInterfac APRSWorker::~APRSWorker() { + stopWork(); m_inputMessageQueue.clear(); } @@ -59,7 +60,6 @@ void APRSWorker::startWork() qDebug("APRSWorker::startWork"); QMutexLocker mutexLocker(&m_mutex); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); - connect(thread(), SIGNAL(finished()), this, SLOT(stopWork())); // Handle any messages already on the queue handleInputMessages(); } diff --git a/plugins/feature/gs232controller/gs232controller.cpp b/plugins/feature/gs232controller/gs232controller.cpp index 78ab0a3b6..86766a185 100644 --- a/plugins/feature/gs232controller/gs232controller.cpp +++ b/plugins/feature/gs232controller/gs232controller.cpp @@ -131,7 +131,7 @@ void GS232Controller::start() { qDebug("GS232Controller::start"); - m_thread = new QThread(this); + m_thread = new QThread(); m_worker = new GS232ControllerWorker(); m_worker->moveToThread(m_thread); QObject::connect(m_thread, &QThread::started, m_worker, &GS232ControllerWorker::startWork); diff --git a/plugins/feature/gs232controller/gs232controllerworker.cpp b/plugins/feature/gs232controller/gs232controllerworker.cpp index 755f61ac0..7de8e1d68 100644 --- a/plugins/feature/gs232controller/gs232controllerworker.cpp +++ b/plugins/feature/gs232controller/gs232controllerworker.cpp @@ -48,6 +48,7 @@ GS232ControllerWorker::GS232ControllerWorker() : GS232ControllerWorker::~GS232ControllerWorker() { qDebug() << "GS232ControllerWorker::~GS232ControllerWorker"; + stopWork(); m_inputMessageQueue.clear(); } @@ -55,7 +56,6 @@ void GS232ControllerWorker::startWork() { qDebug() << "GS232ControllerWorker::startWork"; connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); - connect(thread(), SIGNAL(finished()), this, SLOT(stopWork())); connect(&m_serialPort, &QSerialPort::readyRead, this, &GS232ControllerWorker::readData); connect(&m_socket, &QTcpSocket::readyRead, this, &GS232ControllerWorker::readData); if (m_settings.m_connection == GS232ControllerSettings::TCP) { diff --git a/plugins/feature/pertester/pertester.cpp b/plugins/feature/pertester/pertester.cpp index 882843873..19e72820b 100644 --- a/plugins/feature/pertester/pertester.cpp +++ b/plugins/feature/pertester/pertester.cpp @@ -81,7 +81,7 @@ void PERTester::start() { qDebug("PERTester::start"); - m_thread = new QThread(this); + m_thread = new QThread(); m_worker = new PERTesterWorker(); m_worker->moveToThread(m_thread); diff --git a/plugins/feature/pertester/pertesterworker.cpp b/plugins/feature/pertester/pertesterworker.cpp index d38d71947..96005f4a2 100644 --- a/plugins/feature/pertester/pertesterworker.cpp +++ b/plugins/feature/pertester/pertesterworker.cpp @@ -51,6 +51,7 @@ PERTesterWorker::PERTesterWorker() : PERTesterWorker::~PERTesterWorker() { + stopWork(); closeUDP(); disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); m_inputMessageQueue.clear(); @@ -65,7 +66,6 @@ void PERTesterWorker::startWork() if (m_tx >= m_settings.m_packetCount) resetStats(); connect(&m_txTimer, SIGNAL(timeout()), this, SLOT(tx())); - connect(thread(), SIGNAL(finished()), this, SLOT(stopWork())); m_txTimer.start(m_settings.m_interval * 1000.0); // Handle any messages already on the queue handleInputMessages(); diff --git a/plugins/feature/satellitetracker/satellitetracker.cpp b/plugins/feature/satellitetracker/satellitetracker.cpp index 24670b093..deb36db91 100644 --- a/plugins/feature/satellitetracker/satellitetracker.cpp +++ b/plugins/feature/satellitetracker/satellitetracker.cpp @@ -88,7 +88,7 @@ void SatelliteTracker::start() FeatureWebAPIUtils::mapSetDateTime(currentDateTime()); } - m_thread = new QThread(this); + m_thread = new QThread(); m_worker = new SatelliteTrackerWorker(this, m_webAPIAdapterInterface); m_worker->moveToThread(m_thread); diff --git a/plugins/feature/startracker/startracker.cpp b/plugins/feature/startracker/startracker.cpp index b73e45c02..caae9c2d3 100644 --- a/plugins/feature/startracker/startracker.cpp +++ b/plugins/feature/startracker/startracker.cpp @@ -107,7 +107,7 @@ void StarTracker::start() { qDebug("StarTracker::start"); - m_thread = new QThread(this); + m_thread = new QThread(); m_worker = new StarTrackerWorker(this, m_webAPIAdapterInterface); m_worker->moveToThread(m_thread); diff --git a/plugins/feature/startracker/startrackerworker.cpp b/plugins/feature/startracker/startrackerworker.cpp index 59cedf199..c0a161b68 100644 --- a/plugins/feature/startracker/startrackerworker.cpp +++ b/plugins/feature/startracker/startrackerworker.cpp @@ -60,6 +60,7 @@ StarTrackerWorker::StarTrackerWorker(StarTracker* starTracker, WebAPIAdapterInte StarTrackerWorker::~StarTrackerWorker() { + stopWork(); m_inputMessageQueue.clear(); } @@ -67,7 +68,6 @@ void StarTrackerWorker::startWork() { QMutexLocker mutexLocker(&m_mutex); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); - connect(thread(), SIGNAL(finished()), this, SLOT(stopWork())); m_pollTimer.start((int)round(m_settings.m_updatePeriod*1000.0)); // Handle any messages already on the queue handleInputMessages();