LanguageClient: fix crash on completion assist cancel

The Client might be already deleted when the text editor codeassist
calls cancel on the processor.

Change-Id: I6b0b484a086456ed9d0543f530aea0fae32c523a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-12-08 14:46:01 +01:00
parent 74295626cb
commit 5d75f1900b

View File

@@ -392,8 +392,10 @@ bool LanguageClientCompletionAssistProcessor::running()
void LanguageClientCompletionAssistProcessor::cancel()
{
if (m_currentRequest.has_value()) {
m_client->cancelRequest(m_currentRequest.value());
m_client->removeAssistProcessor(this);
if (m_client) {
m_client->cancelRequest(m_currentRequest.value());
m_client->removeAssistProcessor(this);
}
m_currentRequest.reset();
} else if (m_postponedUpdateConnection) {
QObject::disconnect(m_postponedUpdateConnection);