aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/rgscan
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General/rgscan')
-rw-r--r--src/plugins/General/rgscan/rgscandialog.cpp2
-rw-r--r--src/plugins/General/rgscan/rgscaner.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/General/rgscan/rgscandialog.cpp b/src/plugins/General/rgscan/rgscandialog.cpp
index 383bc687e..79e213a20 100644
--- a/src/plugins/General/rgscan/rgscandialog.cpp
+++ b/src/plugins/General/rgscan/rgscandialog.cpp
@@ -141,7 +141,9 @@ void RGScanDialog::stop()
if(m_scaners.isEmpty())
return;
foreach (RGScaner *scaner, m_scaners)
+ {
scaner->stop();
+ }
QThreadPool::globalInstance()->waitForDone();
qDeleteAll(m_scaners);
m_scaners.clear();
diff --git a/src/plugins/General/rgscan/rgscaner.cpp b/src/plugins/General/rgscan/rgscaner.cpp
index 99e0e1ac3..2f1d5cc01 100644
--- a/src/plugins/General/rgscan/rgscaner.cpp
+++ b/src/plugins/General/rgscan/rgscaner.cpp
@@ -104,6 +104,7 @@ bool RGScaner::prepare(const QString &url)
}
m_decoder = decoder;
m_source = source;
+ m_user_stop = false;
return true;
}
@@ -112,7 +113,6 @@ void RGScaner::stop()
m_mutex.lock();
m_user_stop = true;
m_mutex.unlock();
- wait();
}
bool RGScaner::isRunning()
@@ -137,6 +137,8 @@ GainHandle_t *RGScaner::handle()
void RGScaner::run()
{
+ if(m_user_stop)
+ return;
m_is_running = true;
qDebug("RGScaner: staring thread %lu", QThread::currentThreadId());
m_user_stop = false;
@@ -268,7 +270,7 @@ void RGScaner::run()
m_peak = max/32768.0;
qDebug("RGScaner: peak = %f", m_peak);
qDebug("RGScaner: thread %lu finished", QThread::currentThreadId());
- m_is_running = false;
emit progress(100);
emit finished(m_url);
+ m_is_running = false;
}