forked from qt-creator/qt-creator
LanguageClient: do not assert on sending messages to a dying client
Fixes: QTCREATORBUG-29747 Change-Id: I14067695425d74eaeaa255b370ebf4106c0ac591 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -697,6 +697,12 @@ void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdat
|
||||
Schedule semanticTokensSchedule)
|
||||
{
|
||||
QTC_ASSERT(d->m_clientInterface, return);
|
||||
if (d->m_state == Shutdown || d->m_state == ShutdownRequested) {
|
||||
auto key = message.toJsonObject().contains(methodKey) ? QString(methodKey) : QString(idKey);
|
||||
const QString method = message.toJsonObject()[key].toString();
|
||||
qCDebug(LOGLSPCLIENT) << "Ignoring message " << method << " because client is shutting down";
|
||||
return;
|
||||
}
|
||||
QTC_ASSERT(d->m_state == Initialized, return);
|
||||
if (sendUpdates == SendDocUpdates::Send)
|
||||
d->sendPostponedDocumentUpdates(semanticTokensSchedule);
|
||||
|
Reference in New Issue
Block a user