OSDN Git Service

Fix crash with removing files in symlinked directories
authordt <qtc-committer@nokia.com>
Wed, 2 Jun 2010 09:58:25 +0000 (11:58 +0200)
committerdt <qtc-committer@nokia.com>
Wed, 2 Jun 2010 09:58:25 +0000 (11:58 +0200)
Reviewed-By: thorbjorn
Task-Nr: QTCREATORBUG-965

src/plugins/coreplugin/filemanager.cpp

index b38b522..1d0a681 100644 (file)
@@ -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);
     }
 }