forked from qt-creator/qt-creator
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 <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -29,11 +29,13 @@
|
||||
#include "cpprefactoringchanges.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include "cpptoolsplugin.h"
|
||||
#include "projectinfo.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
@@ -572,4 +574,14 @@ NamespaceAST *NSCheckerVisitor::currentNamespace()
|
||||
return m_enteredNamespaces.empty() ? nullptr : m_enteredNamespaces.back();
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *projectForProjectPart(const ProjectPart &part)
|
||||
{
|
||||
return ProjectExplorer::SessionManager::projectWithProjectFilePath(part.topLevelProject);
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *projectForProjectInfo(const ProjectInfo &info)
|
||||
{
|
||||
return ProjectExplorer::SessionManager::projectWithProjectFilePath(info.projectFilePath());
|
||||
}
|
||||
|
||||
} // CppTools
|
||||
|
||||
Reference in New Issue
Block a user