Skip to content

Commit

Permalink
Fix duplicate suggestions on first open
Browse files Browse the repository at this point in the history
Fix display of duplicate suggestion results in the sidebar under a race
condition present right after creating a new PoeditFrame window.
  • Loading branch information
vslavik committed Sep 28, 2023
1 parent 67829fb commit b8bc768
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ void SuggestionsSidebarBlock::OnDelayedShowSuggestionsForItem(wxTimerEvent&)
void SuggestionsSidebarBlock::QueryAllProviders(const CatalogItemPtr& item)
{
auto thisQueryId = ++m_latestQueryId;

// At this point, we know we're not interested in any older results, but some might have
// arrived asynchronously in between ClearSuggestions() call and now. So make sure there
// are no old suggestions present right after increasing the query ID:
m_suggestions.clear();

QueryProvider(TranslationMemory::Get(), item, thisQueryId);
}

Expand Down

0 comments on commit b8bc768

Please sign in to comment.