Create local copy of runnerContext in the runnerjob ctor

svn path=/trunk/KDE/kdelibs/; revision=938690
This commit is contained in:
Jacopo De Simoi 2009-03-12 17:25:13 +00:00
parent 766bca2524
commit 25a80b322c
3 changed files with 5 additions and 6 deletions

View File

@ -132,7 +132,7 @@ void AbstractRunner::reloadConfiguration()
{
}
void AbstractRunner::performMatch(Plasma::RunnerContext &globalContext)
void AbstractRunner::performMatch(Plasma::RunnerContext &localContext)
{
static const int reasonableRunTime = 1500;
static const int fastEnoughTime = 250;
@ -140,9 +140,8 @@ void AbstractRunner::performMatch(Plasma::RunnerContext &globalContext)
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();
bool slowed = speed() == SlowSpeed;

View File

@ -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),
m_context(*context, 0),
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

View File

@ -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;