From b8bc768538a371955f349dea6d44a60e13833d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Thu, 28 Sep 2023 16:36:59 +0200 Subject: [PATCH] Fix duplicate suggestions on first open Fix display of duplicate suggestion results in the sidebar under a race condition present right after creating a new PoeditFrame window. --- src/sidebar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sidebar.cpp b/src/sidebar.cpp index 350be59541..fdbc77194d 100644 --- a/src/sidebar.cpp +++ b/src/sidebar.cpp @@ -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); }