forked from qt-creator/qt-creator
qmljs: fix racing condition with importPaths
fixes QTCREATORBUG-6768 Change-Id: I53646df69aa9d0ce97006c68826b02a1452fe4d9 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -650,6 +650,7 @@ bool ModelManager::matchesMimeType(const Core::MimeType &fileMimeType, const Cor
|
|||||||
|
|
||||||
QStringList ModelManager::importPaths() const
|
QStringList ModelManager::importPaths() const
|
||||||
{
|
{
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
return m_allImportPaths;
|
return m_allImportPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,18 +676,24 @@ static QStringList environmentImportPaths()
|
|||||||
|
|
||||||
void ModelManager::updateImportPaths()
|
void ModelManager::updateImportPaths()
|
||||||
{
|
{
|
||||||
m_allImportPaths.clear();
|
QStringList allImportPaths;
|
||||||
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
|
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
foreach (const QString &path, it.value().importPaths) {
|
foreach (const QString &path, it.value().importPaths) {
|
||||||
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
||||||
if (!canonicalPath.isEmpty())
|
if (!canonicalPath.isEmpty())
|
||||||
m_allImportPaths += canonicalPath;
|
allImportPaths += canonicalPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_allImportPaths += m_defaultImportPaths;
|
allImportPaths += m_defaultImportPaths;
|
||||||
m_allImportPaths.removeDuplicates();
|
allImportPaths.removeDuplicates();
|
||||||
|
|
||||||
|
{
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
|
m_allImportPaths = allImportPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if any file in the snapshot imports something new in the new paths
|
// check if any file in the snapshot imports something new in the new paths
|
||||||
Snapshot snapshot = _validSnapshot;
|
Snapshot snapshot = _validSnapshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user