Commit 802b67ff authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Erik Verbruggen

CppTools: Protect SnapshotUpdater getters by mutex

Task-number: QTCREATORBUG-10282

Change-Id: Ia58359f774c72260956caecd5f63d44b612d1451
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 56c3d8ff
...@@ -182,28 +182,42 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy) ...@@ -182,28 +182,42 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
Document::Ptr SnapshotUpdater::document() const Document::Ptr SnapshotUpdater::document() const
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
return m_snapshot.document(m_fileInEditor); return m_snapshot.document(m_fileInEditor);
} }
ProjectPart::Ptr SnapshotUpdater::currentProjectPart() const Snapshot SnapshotUpdater::snapshot() const
{
QMutexLocker locker(&m_mutex);
return m_snapshot;
}
QStringList SnapshotUpdater::includePaths() const
{
QMutexLocker locker(&m_mutex);
return m_includePaths;
}
QStringList SnapshotUpdater::frameworkPaths() const
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
return m_frameworkPaths;
}
ProjectPart::Ptr SnapshotUpdater::currentProjectPart() const
{
QMutexLocker locker(&m_mutex);
return m_projectPart; return m_projectPart;
} }
void SnapshotUpdater::setProjectPart(ProjectPart::Ptr projectPart) void SnapshotUpdater::setProjectPart(ProjectPart::Ptr projectPart)
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
m_manuallySetProjectPart = projectPart; m_manuallySetProjectPart = projectPart;
} }
void SnapshotUpdater::setUsePrecompiledHeaders(bool usePrecompiledHeaders) void SnapshotUpdater::setUsePrecompiledHeaders(bool usePrecompiledHeaders)
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
m_usePrecompiledHeaders = usePrecompiledHeaders; m_usePrecompiledHeaders = usePrecompiledHeaders;
} }
......
...@@ -54,15 +54,9 @@ public: ...@@ -54,15 +54,9 @@ public:
void update(CppModelManagerInterface::WorkingCopy workingCopy); void update(CppModelManagerInterface::WorkingCopy workingCopy);
CPlusPlus::Document::Ptr document() const; CPlusPlus::Document::Ptr document() const;
CPlusPlus::Snapshot snapshot() const;
CPlusPlus::Snapshot snapshot() const QStringList includePaths() const;
{ return m_snapshot; } QStringList frameworkPaths() const;
QStringList includePaths() const
{ return m_includePaths; }
QStringList frameworkPaths() const
{ return m_frameworkPaths; }
ProjectPart::Ptr currentProjectPart() const; ProjectPart::Ptr currentProjectPart() const;
void setProjectPart(ProjectPart::Ptr projectPart); void setProjectPart(ProjectPart::Ptr projectPart);
...@@ -76,7 +70,7 @@ private: ...@@ -76,7 +70,7 @@ private:
private: private:
mutable QMutex m_mutex; mutable QMutex m_mutex;
QString m_fileInEditor; const QString m_fileInEditor;
ProjectPart::Ptr m_projectPart, m_manuallySetProjectPart; ProjectPart::Ptr m_projectPart, m_manuallySetProjectPart;
QByteArray m_configFile; QByteArray m_configFile;
bool m_editorDefinesChangedSinceLastUpdate; bool m_editorDefinesChangedSinceLastUpdate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment