registry: Check for canceled search prior to sorting results

This gives a slightly noticeable performance improvement.
This commit is contained in:
Oleg Shparber 2016-07-20 02:10:27 -04:00
parent 40b8d4ac0a
commit 4b3e1df51d

View File

@ -149,10 +149,16 @@ void DocsetRegistry::_runQuery(const QString &query, const CancellationToken &to
query, token),
&MergeQueryResults);
QList<SearchResult> results = queryResultsFuture.result();
if (token.isCanceled())
return;
std::sort(results.begin(), results.end());
if (!token.isCanceled())
emit queryCompleted(results);
if (token.isCanceled())
return;
emit queryCompleted(results);
}
// Recursively finds and adds all docsets in a given directory.