From 89e8786c5dd2c8f8434796a49bc4f59c2472e92c Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 3 Mar 2009 16:44:35 +0000 Subject: [PATCH] SVN_SILENT: some minor clean ups here and there svn path=/trunk/KDE/kdelibs/; revision=934712 --- runnercontext.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/runnercontext.cpp b/runnercontext.cpp index 4967816a3..c10f97161 100644 --- a/runnercontext.cpp +++ b/runnercontext.cpp @@ -243,14 +243,16 @@ void RunnerContext::reset() // We will detach if we are a copy of someone. But we will reset // if we are the 'main' context others copied from. Resetting // one RunnerContext makes all the copies obsolete. - - d->q = 0; //we need to mark the q pointer of the detached RunnerContextPrivate - //as dirty on detach to avoid receiving results for old queries + + //we need to mark the q pointer of the detached RunnerContextPrivate + //as dirty on detach to avoid receiving results for old queries + d->q = 0; d.detach(); - - d->q = this; //now that we detached the d pointer we need to mark its q pointer as - //this to receive the signals + + //now that we detached the d pointer we need to mark its q pointer as + //this to receive the signals + d->q = this; // we still have to remove all the matches, since if the // ref count was 1 (e.g. only the RunnerContext is using @@ -301,7 +303,8 @@ bool RunnerContext::addMatches(const QString &term, const QList &mat { Q_UNUSED(term) - if (matches.isEmpty() || (!d->q)) { //Bail out if the query is empty or the qptr is dirty + if (matches.isEmpty() || !d->q) { + //Bail out if the query is empty or the qptr is dirty return false; } @@ -321,7 +324,7 @@ bool RunnerContext::addMatches(const QString &term, const QList &mat // we always want to sent the signal of the object that created // the d pointer emit d->q->matchesChanged(); - + return true; } @@ -329,17 +332,17 @@ bool RunnerContext::addMatch(const QString &term, const QueryMatch &match) { Q_UNUSED(term) - if (!d->q) { // Bail out if the qptr is dirty + if (!d->q) { + // Bail out if the qptr is dirty return false; } - + LOCK_FOR_WRITE(this) d->matches.append(match); d->matchesById.insert(match.id(), &d->matches.at(d->matches.size() - 1)); UNLOCK(this); //kDebug()<< "added match" << match->text(); emit d->q->matchesChanged(); - return true; }