diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 90aeb397525..84297254919 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -245,8 +245,10 @@ void EditorView::updateEditorHistory(IEditor *editor, QList &histo for (int i = 0; i < history.size(); ++i) { const EditLocation &item = history.at(i); - if (item.document == document - || (!item.document && !DocumentModel::indexOfFilePath(item.filePath))) { + // remove items that refer to the same document/file, + // or that are no longer in the "open documents" + if (item.document == document || (!item.document && item.filePath == document->filePath()) + || (!item.document && !DocumentModel::indexOfFilePath(item.filePath))) { history.removeAt(i--); } }