aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppcheck/cppchecktrigger.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <[email protected]>2021-05-07 16:10:07 +0200
committerChristian Kandeler <[email protected]>2021-08-13 12:35:49 +0000
commit33108795d6b2dd1e91942efb3c1c27ad23342295 (patch)
tree084d21ac56db3c55c84f242acc8400f2e68cd81c /src/plugins/cppcheck/cppchecktrigger.cpp
parent3143ba79e3d954e006f261cc0a535724a4fdc08a (diff)
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 <[email protected]>
Diffstat (limited to 'src/plugins/cppcheck/cppchecktrigger.cpp')
-rw-r--r--src/plugins/cppcheck/cppchecktrigger.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/cppcheck/cppchecktrigger.cpp b/src/plugins/cppcheck/cppchecktrigger.cpp
index 5007ad6161d..93a36596a64 100644
--- a/src/plugins/cppcheck/cppchecktrigger.cpp
+++ b/src/plugins/cppcheck/cppchecktrigger.cpp
@@ -76,8 +76,9 @@ void CppcheckTrigger::checkEditors(const QList<Core::IEditor *> &editors)
return;
using CppModelManager = CppTools::CppModelManager;
- const CppTools::ProjectInfo info = CppModelManager::instance()->projectInfo(m_currentProject);
- if (!info.isValid())
+ const CppTools::ProjectInfo::Ptr info
+ = CppModelManager::instance()->projectInfo(m_currentProject);
+ if (!info)
return;
const QList<Core::IEditor *> editorList = !editors.isEmpty()
@@ -99,7 +100,7 @@ void CppcheckTrigger::checkEditors(const QList<Core::IEditor *> &editors)
continue;
const QString &pathString = path.toString();
- if (!info.sourceFiles().contains(pathString))
+ if (!info->sourceFiles().contains(pathString))
continue;
connect(document, &Core::IDocument::aboutToReload,