From 0d12d6b3b82dd6d3eb16cdfa5b8626182658ccc3 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Thu, 5 Mar 2009 06:02:11 +0000 Subject: [PATCH] Uff, I guess we will live with duplicates for some more time. My previous commit breaks krunner as it *only* runs stuff which is autocompleted. Will backrevert - svn path=/trunk/KDE/kdelibs/; revision=935428 --- abstractrunner.cpp | 4 +++- private/runnerjobs.cpp | 4 ++-- private/runnerjobs.h | 2 +- runnermanager.cpp | 5 ++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/abstractrunner.cpp b/abstractrunner.cpp index b4e88f357..32bd4209d 100644 --- a/abstractrunner.cpp +++ b/abstractrunner.cpp @@ -132,7 +132,7 @@ void AbstractRunner::reloadConfiguration() { } -void AbstractRunner::performMatch(Plasma::RunnerContext &localContext) +void AbstractRunner::performMatch(Plasma::RunnerContext &globalContext) { static const int reasonableRunTime = 1500; static const int fastEnoughTime = 250; @@ -140,6 +140,8 @@ void AbstractRunner::performMatch(Plasma::RunnerContext &localContext) d->runtime.restart(); //The local copy is already obtained in the job + RunnerContext localContext(globalContext, 0); + match(localContext); // automatically rate limit runners that become slooow const int runtime = d->runtime.elapsed(); diff --git a/private/runnerjobs.cpp b/private/runnerjobs.cpp index c2aab6ad7..caba338c5 100644 --- a/private/runnerjobs.cpp +++ b/private/runnerjobs.cpp @@ -125,7 +125,7 @@ void DefaultRunnerPolicy::destructed(Job *job) FindMatchesJob::FindMatchesJob(Plasma::AbstractRunner *runner, Plasma::RunnerContext *context, QObject *parent) : ThreadWeaver::Job(parent), - m_context(*context, 0), + m_context(context), m_runner(runner), m_timer(0), m_stale(false) @@ -155,7 +155,7 @@ void FindMatchesJob::run() { // kDebug() << "Running match for " << m_runner->objectName() // << " in Thread " << thread()->id() << endl; - m_runner->performMatch(m_context); + m_runner->performMatch(*m_context); } int FindMatchesJob::priority() const diff --git a/private/runnerjobs.h b/private/runnerjobs.h index 7c0dcd48d..a0d88dc8b 100644 --- a/private/runnerjobs.h +++ b/private/runnerjobs.h @@ -118,7 +118,7 @@ protected: void run(); private: - Plasma::RunnerContext m_context; + Plasma::RunnerContext *m_context; Plasma::AbstractRunner *m_runner; QTimer *m_timer; bool m_stale; diff --git a/runnermanager.cpp b/runnermanager.cpp index cf0bec8dd..739153ec6 100644 --- a/runnermanager.cpp +++ b/runnermanager.cpp @@ -390,9 +390,8 @@ bool RunnerManager::execQuery(const QString &term, const QString &runnerName) //kDebug() << "ignored!"; return false; } - //CHECK: the match is performed in the same thread, do we really need a local copy? - RunnerContext localContext(d->context, 0); - r->performMatch(localContext); + + r->performMatch(d->context); //kDebug() << "succeeded with" << d->context.matches().count() << "results"; emit matchesChanged(d->context.matches()); return true;