LanguageClient: fix multiple crashes in languageClient

The temporary containers are needed in some places because the content of the containers change
while iterating over them.
partially reverts: cf010911f7

Change-Id: I4d6df987b9e5382b6b18fa659b1174ca6919a02e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-01-22 14:26:11 +01:00
parent fecb0a4c83
commit 4f1c5bacb9
3 changed files with 9 additions and 8 deletions

View File

@@ -111,8 +111,9 @@ Client::~Client()
using namespace TextEditor;
// FIXME: instead of replacing the completion provider in the text document store the
// completion provider as a prioritised list in the text document
for (auto it = m_resetAssistProvider.cbegin(); it != m_resetAssistProvider.cend(); ++it)
resetAssistProviders(it.key());
// temporary container needed since m_resetAssistProvider is changed in resetAssistProviders
for (TextDocument *document : m_resetAssistProvider.keys())
resetAssistProviders(document);
const QList<Core::IEditor *> &editors = Core::DocumentModel::editorsForOpenedDocuments();
for (Core::IEditor *editor : editors) {
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {