diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-06-14 14:41:50 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-06-14 14:41:50 (GMT) |
commit | 08d1b0ab26dea5749461a988e6168f9dea6081f3 (patch) | |
tree | 899b233e1099b211b2ba42106a699699be0b642f /src | |
parent | 59f186869c67ab51fccf3aac3153629a1da285b7 (diff) | |
download | Qt-08d1b0ab26dea5749461a988e6168f9dea6081f3.zip Qt-08d1b0ab26dea5749461a988e6168f9dea6081f3.tar.gz Qt-08d1b0ab26dea5749461a988e6168f9dea6081f3.tar.bz2 |
Revert "QFileInfoGatherer: call QFileSystemWatcher addPaths from proper thread"
This reverts commit 59f186869c67ab51fccf3aac3153629a1da285b7.
Introduced a race condition - QFileInfoGatherer needs a more invasive
refactor to solve the thread safety problems.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer.cpp | 13 | ||||
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer_p.h | 1 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 06c9f39..315b931 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -170,6 +170,7 @@ void QFileInfoGatherer::updateFile(const QString &filePath) void QFileInfoGatherer::clear() { #ifndef QT_NO_FILESYSTEMWATCHER + QMutexLocker locker(&mutex); watcher->removePaths(watcher->files()); watcher->removePaths(watcher->directories()); #endif @@ -183,18 +184,11 @@ void QFileInfoGatherer::clear() void QFileInfoGatherer::removePath(const QString &path) { #ifndef QT_NO_FILESYSTEMWATCHER + QMutexLocker locker(&mutex); watcher->removePath(path); #endif } -void QFileInfoGatherer::addPath(const QString &path) -{ -#ifndef QT_NO_FILESYSTEMWATCHER - if (!watcher->directories().contains(path)) - watcher->addPath(path); -#endif -} - /* List all files in \a directoryPath @@ -286,9 +280,10 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil { #ifndef QT_NO_FILESYSTEMWATCHER if (files.isEmpty() + && !watcher->directories().contains(path) && !path.isEmpty() && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) { - QMetaObject::invokeMethod(this, "addPath", Q_ARG(QString, path)); + watcher->addPath(path); } #endif diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index bff4f69..98217c1 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -162,7 +162,6 @@ public: void clear(); void removePath(const QString &path); - Q_INVOKABLE void addPath(const QString& path); QExtendedInformation getInfo(const QFileInfo &info) const; public Q_SLOTS: |