From edb9defdf63a7538135514d055a376639baad570 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 1 Nov 2020 10:48:47 +0100 Subject: [PATCH] TestSource: moved timer start/stop to constructor/destructor. Fixes issue #661 --- plugins/samplesource/testsource/testsourceworker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/samplesource/testsource/testsourceworker.cpp b/plugins/samplesource/testsource/testsourceworker.cpp index 2d4e72e20..188f7f704 100644 --- a/plugins/samplesource/testsource/testsourceworker.cpp +++ b/plugins/samplesource/testsource/testsourceworker.cpp @@ -65,26 +65,26 @@ TestSourceWorker::TestSourceWorker(SampleSinkFifo* sampleFifo, QObject* parent) m_histoCounter(0) { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); + connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); + m_timer.start(50); } TestSourceWorker::~TestSourceWorker() { + m_timer.stop(); + disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); } void TestSourceWorker::startWork() { qDebug("TestSourceWorker::startWork"); m_timer.setTimerType(Qt::PreciseTimer); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); - m_timer.start(50); m_running = true; } void TestSourceWorker::stopWork() { qDebug("TestSourceWorker::stopWork"); - m_timer.stop(); - disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); m_running = false; }