forked from qt-creator/qt-creator
LanguageClient: prevent accessing deleted document
By always removing them from the list of opened documents also for uninitialized clients. Fixes crash when closing creator before the initialize response of a language server was handled. Change-Id: I81fb15d8d9d7bf47300a6eac373ef9db04387bd4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -459,7 +459,7 @@ void LanguageClientManager::openDocumentWithClient(TextEditor::TextDocument *doc
|
||||
void LanguageClientManager::documentClosed(Core::IDocument *document)
|
||||
{
|
||||
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
|
||||
for (Client *client : reachableClients())
|
||||
for (Client *client : m_clients)
|
||||
client->closeDocument(textDocument);
|
||||
m_clientForDocument.remove(textDocument);
|
||||
}
|
||||
|
Reference in New Issue
Block a user