plasma: remove unused private member

performance gain for the runners, there should be no duplicates and even
if there was the only thing that was done about it is to print a debug
message when build for debugging

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-18 22:05:57 +03:00
parent 595991ff55
commit 6514cb22a6

View file

@ -19,21 +19,17 @@
#include "runnercontext.h" #include "runnercontext.h"
#include <cmath>
#include <QMutex> #include <QMutex>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QSharedData> #include <QSharedData>
#include <kcompletion.h> #include "kshell.h"
#include <kconfiggroup.h> #include "kstandarddirs.h"
#include <kdebug.h> #include "kurl.h"
#include <kshell.h> #include "kprotocolinfo.h"
#include <kstandarddirs.h> #include "kdebug.h"
#include <kurl.h>
#include <kprotocolinfo.h>
#include "abstractrunner.h" #include "abstractrunner.h"
#include "querymatch.h" #include "querymatch.h"
@ -231,7 +227,6 @@ class RunnerContextPrivate : public QSharedData
QMutex lock; QMutex lock;
QList<QueryMatch> matches; QList<QueryMatch> matches;
QMap<QString, const QueryMatch*> matchesById;
QString term; QString term;
RunnerContext::Type type; RunnerContext::Type type;
RunnerContext * q; RunnerContext * q;
@ -296,7 +291,6 @@ void RunnerContext::reset()
// ref count was 1 (e.g. only the RunnerContext is using // ref count was 1 (e.g. only the RunnerContext is using
// the dptr) then we won't get a copy made // the dptr) then we won't get a copy made
if (!d->matches.isEmpty()) { if (!d->matches.isEmpty()) {
d->matchesById.clear();
d->matches.clear(); d->matches.clear();
emit matchesChanged(); emit matchesChanged();
} }
@ -348,15 +342,7 @@ bool RunnerContext::addMatches(const QList<QueryMatch> &matches)
} }
LOCK_FOR_WRITE(d) LOCK_FOR_WRITE(d)
foreach (const QueryMatch &match, matches) { d->matches.append(matches);
d->matches.append(match);
#ifndef NDEBUG
if (d->matchesById.contains(match.id())) {
kDebug() << "Duplicate match id " << match.id() << "from" << match.runner()->name();
}
#endif
d->matchesById.insert(match.id(), &d->matches.at(d->matches.size() - 1));
}
UNLOCK(d); UNLOCK(d);
// kDebug()<< "add matches"; // kDebug()<< "add matches";
// A copied searchContext may share the d pointer, // A copied searchContext may share the d pointer,
@ -375,9 +361,7 @@ bool RunnerContext::addMatch(const QueryMatch &match)
} }
LOCK_FOR_WRITE(d) LOCK_FOR_WRITE(d)
d->matches.append(match); d->matches.append(match);
d->matchesById.insert(match.id(), &d->matches.at(d->matches.size() - 1));
UNLOCK(d); UNLOCK(d);
//kDebug()<< "added match" << match->text(); //kDebug()<< "added match" << match->text();
emit d->q->matchesChanged(); emit d->q->matchesChanged();