diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 19acd7460604b0b9b56ea1ca1c75b5c5a845b299..0ac9f0846feeffcff71824578124deb83a011a01 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -650,6 +650,7 @@ bool ModelManager::matchesMimeType(const Core::MimeType &fileMimeType, const Cor QStringList ModelManager::importPaths() const { + QMutexLocker l(&m_mutex); return m_allImportPaths; } @@ -675,18 +676,24 @@ static QStringList environmentImportPaths() void ModelManager::updateImportPaths() { - m_allImportPaths.clear(); + QStringList allImportPaths; QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects); while (it.hasNext()) { it.next(); foreach (const QString &path, it.value().importPaths) { const QString canonicalPath = QFileInfo(path).canonicalFilePath(); if (!canonicalPath.isEmpty()) - m_allImportPaths += canonicalPath; + allImportPaths += canonicalPath; } } - m_allImportPaths += m_defaultImportPaths; - m_allImportPaths.removeDuplicates(); + allImportPaths += m_defaultImportPaths; + allImportPaths.removeDuplicates(); + + { + QMutexLocker l(&m_mutex); + m_allImportPaths = allImportPaths; + } + // check if any file in the snapshot imports something new in the new paths Snapshot snapshot = _validSnapshot;