From 8f6b496fedf3e3022ed50357cd9838cc46d3e91a Mon Sep 17 00:00:00 2001 From: Itamar Date: Mon, 31 May 2021 23:30:26 +0300 Subject: [PATCH] LibGUI: Add a FIXME about race in AutocompleteBox::apply_suggestion() --- Userland/Libraries/LibGUI/AutocompleteProvider.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index 96370cb4b6..e14978b968 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -92,6 +92,10 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor) void AutocompleteBox::update_suggestions(Vector&& suggestions) { + // FIXME: There's a potential race here if, after the user selected an autocomplete suggestion, + // the LanguageServer sends an update and this function is executed before AutocompleteBox::apply_suggestion() + // is executed. + bool has_suggestions = !suggestions.is_empty(); if (m_suggestion_view->model()) { auto& model = *static_cast(m_suggestion_view->model());