LanguageClient: Make sure to untrack deleted documents

This is a safety net for manually opened documents (not opened via the
EditorManager) so that all pending pointers to those documents are
removed.

Change-Id: I2527db1a5bab387b9f49255ebcde9232afd5a93c
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2024-01-19 13:19:02 +01:00
parent a8b5b1d606
commit b7abde11a0

View File

@@ -618,6 +618,13 @@ void Client::openDocument(TextEditor::TextDocument *document)
if (d->m_openedDocument.contains(document) || !isSupportedDocument(document))
return;
connect(document, &TextDocument::destroyed, this, [this, document] {
d->m_postponedDocuments.remove(document);
d->m_openedDocument.remove(document);
d->m_documentsToUpdate.erase(document);
d->m_resetAssistProvider.remove(document);
});
if (d->m_state != Initialized) {
d->m_postponedDocuments << document;
return;