From d19ca58bf0a3c78ef9925317fd5d31526a6040b9 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 2 Jun 2010 11:58:25 +0200
Subject: [PATCH] Fix crash with removing files in symlinked directories

Reviewed-By: thorbjorn

Task-Nr: QTCREATORBUG-965
---
 src/plugins/coreplugin/filemanager.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp
index b38b5228476..1d0a681c4f8 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);
     }
 }
 
-- 
GitLab