diff options
author | David Schulz <david.schulz@qt.io> | 2020-02-25 13:30:20 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-02-25 13:17:13 +0000 |
commit | 8625bbfe5a7cd9de4139a5d80f3479386c8594bd (patch) | |
tree | a1a31119d21e7b2b0c927c84dedf79a7a16fa761 /src/plugins/languageclient | |
parent | 45381e9d04c7494978dd5cc6a5854a704ef039ba (diff) | |
download | qt-creator-8625bbfe5a7cd9de4139a5d80f3479386c8594bd.tar.gz |
LanguageClient: Fix client restart after crash
Do not clear open documents but disconnect and deactivate them,
so they can be correctly reopened once the server is restarted.
Change-Id: I0f61a5461c020865e61d9808e8c645ea842f64ad
Fixes: QTCREATORBUG-23648
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/languageclient')
-rw-r--r-- | src/plugins/languageclient/client.cpp | 3 | ||||
-rw-r--r-- | src/plugins/languageclient/languageclientmanager.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index a704889fe6..74e0e91db3 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -808,11 +808,12 @@ bool Client::reset() m_responseHandlers.clear(); m_clientInterface->resetBuffer(); updateEditorToolBar(m_openedDocument.keys()); - m_openedDocument.clear(); m_serverCapabilities = ServerCapabilities(); m_dynamicCapabilities.reset(); for (const DocumentUri &uri : m_diagnostics.keys()) removeDiagnostics(uri); + for (TextEditor::TextDocument *document : m_openedDocument.keys()) + document->disconnect(this); for (TextEditor::TextDocument *document : m_resetAssistProvider.keys()) resetAssistProviders(document); return true; diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index 9ca9d06f35..384b78c72d 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -366,6 +366,8 @@ void LanguageClientManager::clientFinished(Client *client) client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS), Core::MessageManager::Flash); QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { startClient(client); }); + for (TextEditor::TextDocument *document : m_clientForDocument.keys(client)) + client->deactivateDocument(document); } else { if (unexpectedFinish && !m_shuttingDown) client->log(tr("Unexpectedly finished."), Core::MessageManager::Flash); |