From 9834b3681fb02ef5eaab19d678b674365a4381e4 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 12 Jan 2012 11:40:51 +0100 Subject: Make QFileSystemWatcherEngines children of QFileSystemWatcher To support moving QFileSystemWatcher to another thread, the engines need to follow when the watcher is moved. The easiest way to do this is by parenting the engines to the watcher. Change-Id: Ie2bb701c0c148da9cc2302d4de23286b8ef42c4d Reviewed-by: Robin Burchell Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemwatcher_inotify.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/corelib/io/qfilesystemwatcher_inotify.cpp') diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 49299e2254..ff732bc70e 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -210,7 +210,7 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE -QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create() +QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) { register int fd = -1; #ifdef IN_CLOEXEC @@ -221,12 +221,13 @@ QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create() if (fd == -1) return 0; } - return new QInotifyFileSystemWatcherEngine(fd); + return new QInotifyFileSystemWatcherEngine(fd, parent); } -QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd) - : inotifyFd(fd) - , notifier(fd, QSocketNotifier::Read, this) +QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd, QObject *parent) + : QFileSystemWatcherEngine(parent), + inotifyFd(fd), + notifier(fd, QSocketNotifier::Read, this) { fcntl(inotifyFd, F_SETFD, FD_CLOEXEC); connect(¬ifier, SIGNAL(activated(int)), SLOT(readFromInotify())); -- cgit v1.2.3