From 78d62789f2f100e6a39d79c041584e33493d0216 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 24 Aug 2019 05:09:56 +0200 Subject: [PATCH] LocalSink: safety measures to ensure processSamples does not work when thread is stopping --- plugins/channelrx/localsink/localsink.cpp | 5 +++++ plugins/channelrx/localsink/localsinkthread.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index 4cfd67a9a..4422685fd 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -111,6 +111,11 @@ void LocalSink::stop() { qDebug("LocalSink::stop"); + disconnect(this, + SIGNAL(samplesAvailable(const quint8*, uint)), + m_sinkThread, + SLOT(processSamples(const quint8*, uint))); + if (m_sinkThread != 0) { m_sinkThread->startStop(false); diff --git a/plugins/channelrx/localsink/localsinkthread.cpp b/plugins/channelrx/localsink/localsinkthread.cpp index 0f5357609..ca8da60e8 100644 --- a/plugins/channelrx/localsink/localsinkthread.cpp +++ b/plugins/channelrx/localsink/localsinkthread.cpp @@ -74,7 +74,7 @@ void LocalSinkThread::run() void LocalSinkThread::processSamples(const quint8* data, uint count) { - if (m_sampleFifo) { + if (m_sampleFifo && m_running) { m_sampleFifo->write(data, count); } }