From ee14ef2f7ca4880a9e1f04fe4109640a38085082 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 20 Dec 2015 16:30:53 +0100 Subject: The generator should produce values one by one. k ...not all at once. --- common/queryrunner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index 718586f..2de3c10 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp @@ -201,7 +201,7 @@ ResultSet QueryRunner::filterSet(const ResultSet &resultSet, const s //Read through the source values and return whatever matches the filter std::function)> generator = [this, resultSetPtr, &db, filter, initialQuery](std::function callback) -> bool { - while (resultSetPtr->next()) { + if (resultSetPtr->next()) { //readEntity is only necessary if we actually want to filter or know the operation type (but not a big deal if we do it always I guess) readEntity(db, resultSetPtr->id(), [this, filter, callback, initialQuery](const Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr &domainObject, Akonadi2::Operation operation) { //Always remove removals, they probably don't match due to non-available properties @@ -216,8 +216,10 @@ ResultSet QueryRunner::filterSet(const ResultSet &resultSet, const s } } }); + return true; + } else { + return false; } - return false; }; return ResultSet(generator); } -- cgit v1.2.3