src/gui/dialogs/qfilesystemmodel.cpp
changeset 22 79de32ba3296
parent 18 2f34d5167611
child 30 5dc02b23752f
--- a/src/gui/dialogs/qfilesystemmodel.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/src/gui/dialogs/qfilesystemmodel.cpp	Fri May 14 16:40:13 2010 +0300
@@ -1361,6 +1361,16 @@
     if (!showDrives && !newPathDir.exists())
         return d->index(rootPath());
 
+    //We remove the watcher on the previous path
+    if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) {
+        //This remove the watcher for the old rootPath
+        d->fileInfoGatherer.removePath(rootPath());
+        //This line "marks" the node as dirty, so the next fetchMore
+        //call on the path will ask the gatherer to install a watcher again
+        //But it doesn't re-fetch everything
+        d->node(rootPath())->populatedChildren = false;
+    }
+
     // We have a new valid root path
     d->rootDir = newPathDir;
     QModelIndex newRootIndex;