diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index b38b5228476eaec08990f53b2b3f4b00e9d3c3fe..1d0a681c4f81b0f12f37859c07022182b4f8c03d 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -273,13 +273,18 @@ void FileManager::removeFileInfo(IFile *file) void FileManager::removeFileInfo(const QString &fileName, IFile *file) { const QString &fixedName = fixFileName(fileName); - d->m_states[fixedName].lastUpdatedState.remove(file); + if (d->m_states[fixedName].lastUpdatedState.contains(file)) { + d->m_states[fixedName].lastUpdatedState.remove(file); - if (d->m_states.value(fixedName).lastUpdatedState.isEmpty()) { - d->m_states.remove(fixedName); - if (!fixedName.isEmpty()) { - d->m_fileWatcher->removePath(fixedName); + if (d->m_states.value(fixedName).lastUpdatedState.isEmpty()) { + d->m_states.remove(fixedName); + if (!fixedName.isEmpty()) { + d->m_fileWatcher->removePath(fixedName); + } } + } else { + // We could not find the fileinfo, try harder to remove it + removeFileInfo(file); } }