1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

ADS-B demod: ADSBDemodWorker: check running state before actual start/stop

This commit is contained in:
f4exb 2021-06-05 19:46:39 +02:00
parent ccb7633154
commit 046c066c11

View File

@ -57,6 +57,11 @@ void ADSBDemodWorker::reset()
bool ADSBDemodWorker::startWork() bool ADSBDemodWorker::startWork()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return m_running;
}
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_heartbeatTimer.start(60*1000); m_heartbeatTimer.start(60*1000);
m_running = true; m_running = true;
@ -66,6 +71,11 @@ bool ADSBDemodWorker::startWork()
void ADSBDemodWorker::stopWork() void ADSBDemodWorker::stopWork()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
m_heartbeatTimer.stop(); m_heartbeatTimer.stop();
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_running = false; m_running = false;