forked from qt-creator/qt-creator
Protected m_dirty and m_projects with a mutex.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <QMap>
|
||||
#include <QFutureInterface>
|
||||
#include <QMutex>
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
@@ -70,9 +71,13 @@ public:
|
||||
virtual ~CppModelManager();
|
||||
|
||||
virtual void updateSourceFiles(const QStringList &sourceFiles);
|
||||
virtual ProjectInfo *projectInfo(ProjectExplorer::Project *project);
|
||||
virtual CPlusPlus::Document::Ptr document(const QString &fileName);
|
||||
virtual DocumentTable documents();
|
||||
|
||||
virtual QList<ProjectInfo> projectInfos() const;
|
||||
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
||||
virtual void updateProjectInfo(const ProjectInfo &pinfo);
|
||||
|
||||
virtual CPlusPlus::Document::Ptr document(const QString &fileName) const;
|
||||
virtual DocumentTable documents() const;
|
||||
virtual void GC();
|
||||
|
||||
QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
|
||||
@@ -127,22 +132,12 @@ private:
|
||||
return m_definedMacros;
|
||||
}
|
||||
|
||||
void ensureUpdated();
|
||||
QStringList updateProjectFiles() const;
|
||||
QStringList updateIncludePaths() const;
|
||||
QStringList updateFrameworkPaths() const;
|
||||
QByteArray updateDefinedMacros() const;
|
||||
|
||||
void ensureUpdated() {
|
||||
if (! m_dirty)
|
||||
return;
|
||||
|
||||
m_projectFiles = updateProjectFiles();
|
||||
m_includePaths = updateIncludePaths();
|
||||
m_frameworkPaths = updateFrameworkPaths();
|
||||
m_definedMacros = updateDefinedMacros();
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
static void parse(QFutureInterface<void> &future,
|
||||
CppPreprocessor *preproc,
|
||||
QStringList files);
|
||||
@@ -166,6 +161,8 @@ private:
|
||||
// project integration
|
||||
QMap<ProjectExplorer::Project *, ProjectInfo> m_projects;
|
||||
|
||||
mutable QMutex mutex;
|
||||
|
||||
enum {
|
||||
MAX_SELECTION_COUNT = 5
|
||||
};
|
||||
|
Reference in New Issue
Block a user