diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index cbd61313a94..8cad21c1d41 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -339,7 +339,7 @@ void Snapshot::insert(const Document::Ptr &document) const QString path = document->path(); remove(fileName); - _documentsByPath.insert(path, document); + _documentsByPath[path].append(document); _documents.insert(fileName, document); } } @@ -353,7 +353,12 @@ void Snapshot::remove(const QString &fileName) { Document::Ptr doc = _documents.value(fileName); if (!doc.isNull()) { - _documentsByPath.remove(doc->path(), doc); + const QString &path = doc->path(); + + QList docs = _documentsByPath.value(path); + docs.removeAll(doc); + _documentsByPath[path] = docs; + _documents.remove(fileName); } } @@ -378,7 +383,7 @@ Document::Ptr Snapshot::document(const QString &fileName) const QList Snapshot::documentsInDirectory(const QString &path) const { - return _documentsByPath.values(QDir::cleanPath(path)); + return _documentsByPath.value(QDir::cleanPath(path)); } LibraryInfo Snapshot::libraryInfo(const QString &path) const diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index fd5c0fbb55f..8e3a3418013 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -146,7 +146,7 @@ class QMLJS_EXPORT Snapshot { typedef QHash _Base; QHash _documents; - QMultiHash _documentsByPath; + QHash > _documentsByPath; QHash _libraries; public: