diff --git a/runners/windows/windowsrunner.h b/runners/windows/windowsrunner.h --- a/runners/windows/windowsrunner.h +++ b/runners/windows/windowsrunner.h @@ -63,7 +63,6 @@ QMutex m_mutex; bool m_inSession : 1; // only used in the main thread - bool m_ready : 1; // protected by m_mutex }; #endif // WINDOWSRUNNER_H diff --git a/runners/windows/windowsrunner.cpp b/runners/windows/windowsrunner.cpp --- a/runners/windows/windowsrunner.cpp +++ b/runners/windows/windowsrunner.cpp @@ -37,8 +37,7 @@ WindowsRunner::WindowsRunner(QObject* parent, const QVariantList& args) : AbstractRunner(parent, args), - m_inSession(false), - m_ready(false) + m_inSession(false) { Q_UNUSED(args) setObjectName( QLatin1String("Windows") ); @@ -70,7 +69,6 @@ // Called in the main thread void WindowsRunner::gatherInfo() { - QMutexLocker locker(&m_mutex); if (!m_inSession) { return; } @@ -101,36 +99,34 @@ m_desktopNames << KWindowSystem::desktopName(i); } - m_ready = true; + // unlock lock locked in prepareForMatchSession + m_mutex.unlock(); } // Called in the main thread void WindowsRunner::prepareForMatchSession() { - QMutexLocker locker(&m_mutex); + // gatherInfo will unlock the lock + m_mutex.lock(); m_inSession = true; - m_ready = false; QTimer::singleShot(0, this, &WindowsRunner::gatherInfo); } // Called in the main thread void WindowsRunner::matchSessionComplete() { QMutexLocker locker(&m_mutex); m_inSession = false; - m_ready = false; m_desktopNames.clear(); m_icons.clear(); m_windows.clear(); } // Called in the secondary thread void WindowsRunner::match(Plasma::RunnerContext& context) { + // will run block as long as gatherInfo has not finished QMutexLocker locker(&m_mutex); - if (!m_ready) { - return; - } QString term = context.query();