From 33108795d6b2dd1e91942efb3c1c27ad23342295 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 7 May 2021 16:10:07 +0200 Subject: CppTools: Turn some classes into pure value types ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers to Project and/or Toolchain, even though they were used in contexts where these pointers were either unsafe to access or not guaranteed to be valid anymore, which made their use difficult and error-prone. We turn these classes into pure value types by copying in all relevant information before the first async operation takes place. Fixes: QTCREATORBUG-25678 Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590 Reviewed-by: Jarek Kobus --- src/plugins/cpptools/cpptoolsplugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/cpptools/cpptoolsplugin.cpp') diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 1e77501c0f..a334846213 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -469,9 +469,9 @@ QString correspondingHeaderOrSource(const QString &fileName, bool *wasHeader, Ca // Find files in other projects } else { CppModelManager *modelManager = CppModelManager::instance(); - QList projectInfos = modelManager->projectInfos(); - foreach (const ProjectInfo &projectInfo, projectInfos) { - const ProjectExplorer::Project *project = projectInfo.project().data(); + QList projectInfos = modelManager->projectInfos(); + foreach (const ProjectInfo::Ptr &projectInfo, projectInfos) { + const ProjectExplorer::Project *project = projectForProjectInfo(*projectInfo); if (project == currentProject) continue; // We have already checked the current project. -- cgit v1.2.1