aboutsummaryrefslogtreecommitdiff
path: root/src/QR-Code-scanner/QrScanThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QR-Code-scanner/QrScanThread.cpp')
-rw-r--r--src/QR-Code-scanner/QrScanThread.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/QR-Code-scanner/QrScanThread.cpp b/src/QR-Code-scanner/QrScanThread.cpp
index b6e9b9ff..48ecb53a 100644
--- a/src/QR-Code-scanner/QrScanThread.cpp
+++ b/src/QR-Code-scanner/QrScanThread.cpp
@@ -110,6 +110,7 @@ void QrScanThread::processVideoFrame(const QVideoFrame &frame)
void QrScanThread::stop()
{
m_running = false;
+ m_waitCondition.wakeOne();
}
void QrScanThread::addFrame(const QVideoFrame &frame)
@@ -124,9 +125,10 @@ void QrScanThread::run()
QVideoFrame frame;
while(m_running) {
QMutexLocker locker(&m_mutex);
- while(m_queue.isEmpty())
+ while(m_queue.isEmpty() && m_running)
m_waitCondition.wait(&m_mutex);
- processVideoFrame(m_queue.takeFirst());
+ if(!m_queue.isEmpty())
+ processVideoFrame(m_queue.takeFirst());
}
}