From bc573bf071708d28a97be273b75d313b23e2a85a Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 10 Oct 2013 09:30:50 +0000 Subject: rgscan: fixed blocking bug git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3769 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/rgscan/rgscandialog.cpp | 2 ++ src/plugins/General/rgscan/rgscaner.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/General/rgscan') 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; } -- cgit v1.2.3-13-gbd6f