Commit 9dc488c2 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

pk: make sure search queries eventually finish

BUG: 432384
parent b9ec2833
......@@ -453,6 +453,7 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
if (!resources.isEmpty()) {
stream->setResources(resources);
}
stream->finish();
};
runWhenInitialized(f, stream);
return stream;
......@@ -466,6 +467,7 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
auto installedAndNameFilter = [filter] (AbstractResource *res) {
return res->state() >= AbstractResource::Installed && (res->name().contains(filter.search) || res->packageName() == filter.search);
};
bool furtherSearch = false;
if (!toResolve.isEmpty()) {
resolvePackages(kTransform<QStringList>(toResolve, [] (AbstractResource* res) { return res->packageName(); }));
connect(m_resolveTransaction, &PKResolveTransaction::allFinished, this, [stream, toResolve, installedAndNameFilter] {
......@@ -474,6 +476,7 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
Q_EMIT stream->resourcesFound(resolved);
stream->finish();
});
furtherSearch = true;
}
const auto resolved = kFilter<QVector<AbstractResource*>>(m_packages.packages, installedAndNameFilter);
......@@ -485,7 +488,11 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
if (toResolve.isEmpty())
stream->finish();
});
furtherSearch = true;
}
if (!furtherSearch)
stream->finish();
};
runWhenInitialized(f, stream);
return stream;
......@@ -496,6 +503,7 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
if (!resources.isEmpty()) {
stream->setResources(resources);
}
stream->finish();
};
runWhenInitialized(f, stream);
return stream;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment