From 7da79f8d44ba06872e5bf298fde7a3fc45df7046 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Aug 2010 13:21:05 +0200 Subject: Fixed potential infinite loop in QFileSystemWatcher on Mac. The patch provided by the customer just jumps to reading the next event fom the kqueue when an unexpected condition happens. Task-number: QTBUG-12533 Reviewed-by: Bradley T. Hughes (cherry picked from commit b7256b1f8c9bb43c5234d24453aaa8b1c079cf06) --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index a64b524..a42a695 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - continue; + goto process_next_event; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - continue; + goto process_next_event; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -337,6 +337,7 @@ void QKqueueFileSystemWatcherEngine::run() } // are there any more? +process_next_event: r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); } while (r > 0); } -- cgit v0.12