summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2010-02-26 07:20:58 (GMT)
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2010-02-26 13:31:07 (GMT)
commitf36a907c40ebe6e22af141946ab8ef405ce3efb8 (patch)
tree56edf2baf96b0971974fe2f57cbdcafc5ea89bd5
parent7ce54e9cc4b35d16c32f4dfc5875038797731f2f (diff)
downloadQt-f36a907c40ebe6e22af141946ab8ef405ce3efb8.zip
Qt-f36a907c40ebe6e22af141946ab8ef405ce3efb8.tar.gz
Qt-f36a907c40ebe6e22af141946ab8ef405ce3efb8.tar.bz2
Fix deadlock in QFSEventsFileSystemWatcherEngine.
Task: QTBUG-8522 6130b2137 makes stop() synchronize and wait for the worker thread to reach the end of run(). stop() was however called from the worker thread itself in updateFiles(), leading to a deadlock. Add the stopFSStream and CFRunLoopStop calls directly to updateFiles(), don't wait on waitForStop.
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
index 54ae24e..efbc290 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.cpp
@@ -445,7 +445,16 @@ void QFSEventsFileSystemWatcherEngine::updateFiles()
updateHash(dirPathInfoHash);
if (filePathInfoHash.isEmpty() && dirPathInfoHash.isEmpty()) {
// Everything disappeared before we got to start, don't bother.
- stop();
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ // Code duplicated from stop(), with the exception that we
+ // don't wait on waitForStop here. Doing this will lead to
+ // a deadlock since this function is called from the worker
+ // thread. (waitForStop.wakeAll() is only called from the
+ // end of run()).
+ stopFSStream(fsStream);
+ if (threadsRunLoop)
+ CFRunLoopStop(threadsRunLoop);
+#endif
cleanupFSStream(fsStream);
}
waitCondition.wakeAll();