qmljs: improve multithreading safety

ensure that the QSet copy operation of the scannedPaths in importScan
is atomic.

Change-Id: Ifb3566a86d1d6ac6abf29f1b4cbe19868947d0cc
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-07-29 20:03:48 +02:00
parent bd3366d8b5
commit 281161c242

View File

@@ -947,7 +947,11 @@ void ModelManagerInterface::importScan(QFutureInterface<void> &future,
bool emitDocChangedOnDisk)
{
// paths we have scanned for files and added to the files list
QSet<QString> scannedPaths = modelManager->m_scannedPaths;
QSet<QString> scannedPaths;
{
QMutexLocker l(&modelManager->m_mutex);
scannedPaths = modelManager->m_scannedPaths;
}
// libraries we've found while scanning imports
QSet<QString> newLibraries;