LibGUI: Add a FIXME about race in AutocompleteBox::apply_suggestion()

This commit is contained in:
Itamar 2021-05-31 23:30:26 +03:00 committed by Andreas Kling
parent 7c2941d4ea
commit 8f6b496fed
Notes: sideshowbarker 2024-07-18 17:05:41 +09:00

View File

@ -92,6 +92,10 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
void AutocompleteBox::update_suggestions(Vector<AutocompleteProvider::Entry>&& 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<AutocompleteSuggestionModel*>(m_suggestion_view->model());