diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp index 09f5ee95075..592f7c8795c 100644 --- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp +++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp @@ -215,8 +215,11 @@ void ClangCompletionAssistProcessor::handleAvailableCompletions(const CodeComple return; } - if (!m_fallbackToNormalCompletion) + if (!m_fallbackToNormalCompletion) { + // We must report back to the code assistant under all circumstances + setAsyncProposalAvailable(nullptr); return; + } // else: Proceed with a normal completion in case: // 1) it was not a function call, but e.g. a function declaration like "void f(" // 2) '{' meant not a constructor call. diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp index ae2eca2ff63..54b9740809c 100644 --- a/src/plugins/languageclient/languageclientcompletionassist.cpp +++ b/src/plugins/languageclient/languageclientcompletionassist.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -361,6 +362,9 @@ void LanguageClientCompletionAssistProcessor::cancel() void LanguageClientCompletionAssistProcessor::handleCompletionResponse( const CompletionRequest::Response &response) { + LanguageClientCompletionProposal *proposal = nullptr; + // We must report back to the code assistant under all circumstances + Utils::ExecuteOnDestruction eod([this, proposal]() { setAsyncProposalAvailable(proposal); }); qCDebug(LOGLSPCOMPLETION) << QTime::currentTime() << " : got completions"; m_currentRequest = MessageId(); QTC_ASSERT(m_client, return); @@ -383,12 +387,11 @@ void LanguageClientCompletionAssistProcessor::handleCompletionResponse( model->loadContent(Utils::transform(items, [](const CompletionItem &item){ return static_cast(new LanguageClientCompletionItem(item)); })); - auto proposal = new LanguageClientCompletionProposal(m_pos, model); + proposal = new LanguageClientCompletionProposal(m_pos, model); proposal->m_document = m_document; proposal->m_pos = m_pos; proposal->setFragile(true); proposal->setSupportsPrefix(false); - setAsyncProposalAvailable(proposal); qCDebug(LOGLSPCOMPLETION) << QTime::currentTime() << " : " << items.count() << " completions handled"; }