forked from qt-creator/qt-creator
CppTools: Use mutex when accessing m_fileToProjectParts
projectPartFromDependencies() is also called from another thread. Change-Id: Ic1319569d1b9b934a1be0916caa2e5bd68dce4fb Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -811,8 +811,12 @@ QList<ProjectPart::Ptr> CppModelManager::projectPartFromDependencies(const QStri
|
|||||||
{
|
{
|
||||||
QSet<ProjectPart::Ptr> parts;
|
QSet<ProjectPart::Ptr> parts;
|
||||||
const QStringList deps = snapshot().filesDependingOn(fileName);
|
const QStringList deps = snapshot().filesDependingOn(fileName);
|
||||||
foreach (const QString &dep, deps)
|
|
||||||
parts.unite(QSet<ProjectPart::Ptr>::fromList(d->m_fileToProjectParts.value(dep)));
|
{
|
||||||
|
QMutexLocker locker(&d->m_projectMutex);
|
||||||
|
foreach (const QString &dep, deps)
|
||||||
|
parts.unite(QSet<ProjectPart::Ptr>::fromList(d->m_fileToProjectParts.value(dep)));
|
||||||
|
}
|
||||||
|
|
||||||
return parts.values();
|
return parts.values();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user