Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -251,8 +251,14 @@ Snapshot::~Snapshot() ...@@ -251,8 +251,14 @@ Snapshot::~Snapshot()
void Snapshot::insert(const Document::Ptr &document) void Snapshot::insert(const Document::Ptr &document)
{ {
if (document && (document->qmlProgram() || document->jsProgram())) { if (document && (document->qmlProgram() || document->jsProgram())) {
_documents.insert(document->fileName(), document); const QString fileName = document->fileName();
_documentsByPath.insert(document->path(), document); 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);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment