1
0
Fork 0

Fix duplicate entries in threaded location search

This commit is contained in:
James Turner 2018-03-15 19:43:14 +01:00
parent 109a59b393
commit d92647b364
2 changed files with 9 additions and 7 deletions

View file

@ -326,13 +326,15 @@ private slots:
}
PositionedIDVec newIds = m_search->results();
m_ids.reserve(newIds.size());
beginInsertRows(QModelIndex(), m_ids.size(), newIds.size() - 1);
for (auto id : newIds) {
m_ids.push_back(id);
m_items.push_back({}); // null ref
if (!newIds.empty()) {
m_ids.reserve(newIds.size());
beginInsertRows(QModelIndex(), m_ids.size(), newIds.size() - 1);
for (auto id : newIds) {
m_ids.push_back(id);
m_items.push_back({}); // null ref
}
endInsertRows();
}
endInsertRows();
if (m_search->isComplete()) {
m_searchActive = false;

View file

@ -2476,7 +2476,7 @@ PositionedIDVec NavDataCache::ThreadedGUISearch::results() const
PositionedIDVec r;
{
SGGuard<SGMutex> g(d->lock);
r = d->results;
r = std::move(d->results);
}
return r;
}