From 2ba9a2584f90bf2849182143d90c988ddb937c3a Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Thu, 10 Apr 2014 15:31:48 +0200 Subject: Fix polling file system watcher addPaths Fixes QFileSystemWatcher::addPath() auto test when polling file system watcher is in use: adding the same path twice should fail. Change-Id: I2a0df3ffa587fa90fae744858f4471d667443e6f Reviewed-by: Oswald Buddenhagen Reviewed-by: Robin Burchell Reviewed-by: Fabian Bumberger --- src/corelib/io/qfilesystemwatcher_polling.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp index 689f05bb1b..401f95ae82 100644 --- a/src/corelib/io/qfilesystemwatcher_polling.cpp +++ b/src/corelib/io/qfilesystemwatcher_polling.cpp @@ -65,14 +65,16 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths, if (!fi.exists()) continue; if (fi.isDir()) { - if (!directories->contains(path)) - directories->append(path); + if (directories->contains(path)) + continue; + directories->append(path); if (!path.endsWith(QLatin1Char('/'))) fi = QFileInfo(path + QLatin1Char('/')); this->directories.insert(path, fi); } else { - if (!files->contains(path)) - files->append(path); + if (files->contains(path)) + continue; + files->append(path); this->files.insert(path, fi); } it.remove(); -- cgit v1.2.3