Fix QFileInfoGatherer threading issue
QFileInfoGatherer has a QFileSystemWatcher member that lives in the same thread as the QFileInfoGatherer object. If only the poller engine is available for the file system watcher, the engine will only be created when addPaths() is called. However the latter was called from anohter thread (the QFileInfoGatherer thread). Hence the QPollingFileSystemWatcherEngine had its parent in a different thread and worse, this thread didn't have an event loop needed for the QTimer used in the poller engine. This fixes tst_qfilesystemmodel on platforms that only support the polling file system watcher engine. Task-Number: QTBUG-29366 Change-Id: I83b58b4237e3438a27e5cdde4b1e4126e4740a94 Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
60b6b28c21
commit
5f7ea1a41a
|
|
@ -146,6 +146,15 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr
|
|||
this->path.push(path);
|
||||
this->files.push(files);
|
||||
condition.wakeAll();
|
||||
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
if (files.isEmpty()
|
||||
&& !path.isEmpty()
|
||||
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
|
||||
if (!watcher->directories().contains(path))
|
||||
watcher->addPath(path);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -269,16 +278,6 @@ static QString translateDriveName(const QFileInfo &drive)
|
|||
*/
|
||||
void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &files)
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
if (files.isEmpty()
|
||||
&& !path.isEmpty()
|
||||
&& !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) {
|
||||
QMutexLocker locker(&mutex);
|
||||
if (!watcher->directories().contains(path))
|
||||
watcher->addPath(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
// List drives
|
||||
if (path.isEmpty()) {
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
|
|
|
|||
Loading…
Reference in New Issue