forked from qt-creator/qt-creator
C++: Do not share dependency table when copying a Snapshot
There are multiple situations were the snapshot is copied and
access/modifications to the dependency table data is made in other
threads, e.g.:
* FindUsages called by ProcessFile
* findReferences() in cppuseselectionsupdater.cpp
* CppModelManager::projectPartFromDependencies() (clang path)
Change-Id: Ided1c5350f339c5bc960b87b32c78ccc21fa61f6
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -715,7 +715,6 @@ bool Document::DiagnosticMessage::operator!=(const Document::DiagnosticMessage &
|
||||
}
|
||||
|
||||
Snapshot::Snapshot()
|
||||
: m_deps(new DependencyTable)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -752,7 +751,7 @@ void Snapshot::insert(Document::Ptr doc)
|
||||
{
|
||||
if (doc) {
|
||||
_documents.insert(doc->fileName(), doc);
|
||||
m_deps->files.clear(); // Will trigger re-build when accessed.
|
||||
m_deps.files.clear(); // Will trigger re-build when accessed.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,13 +815,13 @@ QList<Snapshot::IncludeLocation> Snapshot::includeLocationsOfDocument(const QStr
|
||||
QStringList Snapshot::filesDependingOn(const QString &fileName) const
|
||||
{
|
||||
updateDependencyTable();
|
||||
return m_deps->filesDependingOn(fileName);
|
||||
return m_deps.filesDependingOn(fileName);
|
||||
}
|
||||
|
||||
void Snapshot::updateDependencyTable() const
|
||||
{
|
||||
if (m_deps->files.isEmpty())
|
||||
m_deps->build(*this);
|
||||
if (m_deps.files.isEmpty())
|
||||
m_deps.build(*this);
|
||||
}
|
||||
|
||||
void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const
|
||||
|
||||
Reference in New Issue
Block a user