don't actually do the tear down until we have no more jobs queued up; this way the setup/teardown do not need to be threadsafe and the runner can always assume that the data created in set up is really not needed anymore
svn path=/trunk/KDE/kdelibs/; revision=1004685
This commit is contained in:
parent
a4b980b37b
commit
131c0b39de
@ -57,7 +57,8 @@ public:
|
|||||||
RunnerManagerPrivate(RunnerManager *parent)
|
RunnerManagerPrivate(RunnerManager *parent)
|
||||||
: q(parent),
|
: q(parent),
|
||||||
deferredRun(0),
|
deferredRun(0),
|
||||||
prepped(false)
|
prepped(false),
|
||||||
|
teardownRequested(false)
|
||||||
{
|
{
|
||||||
matchChangeTimer.setSingleShot(true);
|
matchChangeTimer.setSingleShot(true);
|
||||||
delayTimer.setSingleShot(true);
|
delayTimer.setSingleShot(true);
|
||||||
@ -197,6 +198,26 @@ public:
|
|||||||
// ourselves here
|
// ourselves here
|
||||||
emit q->matchesChanged(context.matches());
|
emit q->matchesChanged(context.matches());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkTearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkTearDown()
|
||||||
|
{
|
||||||
|
//kDebug() << prepped << teardownRequested << searchJobs.count() << oldSearchJobs.count();
|
||||||
|
|
||||||
|
if (!prepped || !teardownRequested) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchJobs.isEmpty() && oldSearchJobs.isEmpty()) {
|
||||||
|
foreach (AbstractRunner *runner, runners) {
|
||||||
|
emit runner->teardown();
|
||||||
|
}
|
||||||
|
|
||||||
|
prepped = false;
|
||||||
|
teardownRequested = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unblockJobs()
|
void unblockJobs()
|
||||||
@ -222,6 +243,7 @@ public:
|
|||||||
KConfigGroup config;
|
KConfigGroup config;
|
||||||
bool loadAll : 1;
|
bool loadAll : 1;
|
||||||
bool prepped : 1;
|
bool prepped : 1;
|
||||||
|
bool teardownRequested : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
@ -329,6 +351,8 @@ QList<QAction*> RunnerManager::actionsForMatch(const QueryMatch &match)
|
|||||||
|
|
||||||
void RunnerManager::setupMatchSession()
|
void RunnerManager::setupMatchSession()
|
||||||
{
|
{
|
||||||
|
d->teardownRequested = false;
|
||||||
|
|
||||||
if (d->prepped) {
|
if (d->prepped) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -345,11 +369,8 @@ void RunnerManager::matchSessionComplete()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (AbstractRunner *runner, d->runners) {
|
d->teardownRequested = true;
|
||||||
emit runner->teardown();
|
d->checkTearDown();
|
||||||
}
|
|
||||||
|
|
||||||
d->prepped = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunnerManager::launchQuery(const QString &term)
|
void RunnerManager::launchQuery(const QString &term)
|
||||||
|
Loading…
Reference in New Issue
Block a user