Commit 6f4b8644 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Make Snapshot discard outdated Documents.

Previously, fresh versions of a Document would be added to the
_documentsByPath QMultiHash without removing the old version first.
This means Link could pick up old versions of a Document.

Task-number: QTCREATORBUG-1418
parent bb6af213
......@@ -251,8 +251,14 @@ Snapshot::~Snapshot()
void Snapshot::insert(const Document::Ptr &document)
if (document && (document->qmlProgram() || document->jsProgram())) {
_documents.insert(document->fileName(), document);
_documentsByPath.insert(document->path(), document);
const QString fileName = document->fileName();
const QString path = document->path();
Document::Ptr old = _documents.value(fileName);
if (old)
_documentsByPath.remove(path, old);
_documentsByPath.insert(path, document);
_documents.insert(fileName, document);
Supports Markdown
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