A bit more efficient adding/removing of file watchers.

Each call of addPath(s) removePath(s) potentially is locking and
unlocking a mutex, so do it for all paths at once.
This commit is contained in:
con
2010-03-05 12:55:04 +01:00
parent aa9b362d86
commit afe939ef23

View File

@@ -720,7 +720,9 @@ void FileManager::checkForReload()
IFile::ReloadBehavior behavior = EditorManager::instance()->reloadBehavior();
QStringList allFileNames;
foreach(const QString &fileName, d->m_changedFiles) {
allFileNames << fileName;
// Get the information from the filesystem
QFileInfo fi(fileName);
bool expected = false;
@@ -756,13 +758,12 @@ void FileManager::checkForReload()
}
updateFileInfo(it.key());
}
}
d->m_fileWatcher->removePath(fileName);
d->m_fileWatcher->addPath(fileName);
}
if (!allFileNames.isEmpty()) {
d->m_fileWatcher->removePaths(allFileNames);
d->m_fileWatcher->addPaths(allFileNames);
}
d->m_changedFiles.clear();
d->m_blockActivated = false;
}