summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qfilesystemmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/dialogs/qfilesystemmodel.cpp')
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 2f1933c..8a6190f 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -1373,6 +1373,16 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
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;