From 05ce5ea14df56c0394ba78679a581b9a40bec5cf Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 6 Nov 2023 14:13:11 +0100 Subject: [PATCH] CppEditor: Fix crash when calling CppModelManager::projectPart find and end of QMap potentially detach the container, so we have to use constFind and constEnd Fixes: QTCREATORBUG-29716 Change-Id: I2fef46580ff5b58a70201841423e5ca0a7b4d107 Reviewed-by: Cristian Adam Reviewed-by: --- src/plugins/cppeditor/cppmodelmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index e72c630cbf7..52f0ea89845 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -1647,8 +1647,8 @@ QList CppModelManager::projectPart(const FilePath &fileNa { { QReadLocker locker(&d->m_projectLock); - auto it = d->m_fileToProjectParts.find(fileName); - if (it != d->m_fileToProjectParts.end()) + auto it = d->m_fileToProjectParts.constFind(fileName); + if (it != d->m_fileToProjectParts.constEnd()) return it.value(); } const FilePath canonicalPath = fileName.canonicalPath();