1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Call stopWork from destructor.

This commit is contained in:
Jon Beniston 2022-09-20 21:13:12 +01:00
parent db2aa78e0a
commit b1ce69fb2b
9 changed files with 9 additions and 9 deletions

View File

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

View File

@ -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();
}

View File

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

View File

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

View File

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

View File

@ -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();

View File

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

View File

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

View File

@ -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();