forked from qt-creator/qt-creator
LanguageClient: postpone unreachable server error reporting
Since the overall nature of the communication is asynchronous calling functions might not expect that an error is reported from within the sendMessage function. Fixes: QTCREATORBUG-31054 Change-Id: Ie73510eb632408a9f7a9367c3a3e47ad021da7fe Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -735,7 +735,7 @@ void Client::openDocument(TextEditor::TextDocument *document)
|
|||||||
void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdates,
|
void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdates,
|
||||||
Schedule semanticTokensSchedule)
|
Schedule semanticTokensSchedule)
|
||||||
{
|
{
|
||||||
QScopeGuard guard([responseHandler = message.responseHandler()](){
|
QScopeGuard guard([this, responseHandler = message.responseHandler()](){
|
||||||
if (responseHandler) {
|
if (responseHandler) {
|
||||||
static ResponseError<std::nullptr_t> error;
|
static ResponseError<std::nullptr_t> error;
|
||||||
if (!error.isValid()) {
|
if (!error.isValid()) {
|
||||||
@@ -745,7 +745,9 @@ void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdat
|
|||||||
QJsonObject response;
|
QJsonObject response;
|
||||||
response[idKey] = responseHandler->id;
|
response[idKey] = responseHandler->id;
|
||||||
response[errorKey] = QJsonObject(error);
|
response[errorKey] = QJsonObject(error);
|
||||||
responseHandler->callback(JsonRpcMessage(response));
|
QMetaObject::invokeMethod(this, [callback = responseHandler->callback, response](){
|
||||||
|
callback(JsonRpcMessage(response));
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user