summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_inotify.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-01-11 12:42:50 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-12 00:45:10 +0100
commitd6e0306a90597ff17931dba0a11a593c5f1a7221 (patch)
tree55ee2576102b96258229bc1ab495de77e016775d /src/corelib/io/qfilesystemwatcher_inotify.cpp
parentdd22fe636b026dfc7413f4b3e564f5f1b4a791de (diff)
Avoid races when destroying QFileSystemWatcher
On Mac OS X, socket notifiers need to be disabled/destroyed before closing their associated file descriptor, otherwise we cause races inside the CFSocket system. The documentation for CFSocketInvalidate() says that we close the file descriptor after calling this function when the kCFSocketCloseOnInvalidate flag is explicitly cleared (QCocoaEventDispatcher clears this flag). Do the same on the Linux inotify watcher as well, for symmetry. Change-Id: I5592cc4bb5be4b752e48d895a685d3c92826acc7 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_inotify.cpp')
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index c1314e61c7..80eb6303cc 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -234,6 +234,7 @@ QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd)
QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine()
{
+ notifier.setEnabled(false);
foreach (int id, pathToID)
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);