required to lower memory consumption for PA4
This commit is contained in:
parent
259c155c9b
commit
e30067518f
@ -483,6 +483,37 @@ bool RunnerContext::removeMatch(const QString matchId)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RunnerContext::removeMatches(Plasma::AbstractRunner *runner)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<QueryMatch> presentMatchList;
|
||||
|
||||
LOCK_FOR_READ(d)
|
||||
foreach(const QueryMatch &match, d->matches) {
|
||||
if (match.runner() == runner) {
|
||||
presentMatchList << match;
|
||||
}
|
||||
}
|
||||
UNLOCK(d)
|
||||
|
||||
if (presentMatchList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LOCK_FOR_WRITE(d)
|
||||
foreach (const QueryMatch &match, presentMatchList) {
|
||||
d->matchesById.remove(match.id());
|
||||
d->matches.removeAll(match);
|
||||
}
|
||||
UNLOCK(d)
|
||||
|
||||
emit d->q->matchesChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QueryMatch> RunnerContext::matches() const
|
||||
{
|
||||
LOCK_FOR_READ(d)
|
||||
|
@ -179,6 +179,18 @@ class PLASMA_EXPORT RunnerContext : public QObject
|
||||
*/
|
||||
bool removeMatches(const QStringList matchIdList);
|
||||
|
||||
/**
|
||||
* Removes lists of matches from a given AbstractRunner
|
||||
*
|
||||
* This method is thread safe and causes the matchesChanged() signal to be emitted.
|
||||
*
|
||||
* @param runner the AbstractRunner from which to remove matches
|
||||
*
|
||||
* @return true if at least one match was removed, false otherwise.
|
||||
* @since 4.10
|
||||
*/
|
||||
bool removeMatches(AbstractRunner *runner);
|
||||
|
||||
/**
|
||||
* Retrieves all available matches for the current search term.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user