Commit b43dade4 authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

qmljs: fix racing condition with importPaths



fixes QTCREATORBUG-6768

Change-Id: I53646df69aa9d0ce97006c68826b02a1452fe4d9
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent c287d906
......@@ -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;
......
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