diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index c385a82..7454725 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -64,7 +64,7 @@
 
 QT_BEGIN_NAMESPACE
 
-// #define WINQFSW_DEBUG
+#define WINQFSW_DEBUG
 #ifdef WINQFSW_DEBUG
 #  define DEBUG qDebug
 #else
@@ -322,6 +322,27 @@ QWindowsFileSystemWatcherEngine::Handle::Handle()
 {
 }
 
+QDebug operator<<(QDebug d, const QWindowsFileSystemWatcherEngine::Handle &h)
+{
+    QDebugStateSaver ds(d);
+    d << "Handle(" << h.handle << ',' << hex << showbase << h.flags << ')';
+    return d;
+}
+
+QDebug operator<<(QDebug d, const QWindowsFileSystemWatcherEngine::PathInfo &p)
+{
+    d << "PathInfo(" << p.absolutePath << ",isDir=" << p.isDir << ')';
+    return d;
+}
+
+QDebug operator<<(QDebug d, const QWindowsFileSystemWatcherEngineThread *t)
+{
+    d << "Thread(" <<static_cast<const void *>(t) <<
+         ", handleForDir=" << t->handleForDir.size() <<  t->handleForDir
+      << ", pathInfoForHandle=" << t->pathInfoForHandle.size() << t->pathInfoForHandle;
+    return d;
+}
+
 QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent)
     : QFileSystemWatcherEngine(parent)
 #ifndef Q_OS_WINRT
@@ -353,7 +374,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
                                                        QStringList *files,
                                                        QStringList *directories)
 {
-    DEBUG() << "Adding" << paths.count() << "to existing" << (files->count() + directories->count()) << "watchers";
+    DEBUG() << __FUNCTION__ << ">Adding" << paths.count() << paths << "to existing" << (files->count() + directories->count()) << "watchers";
     QStringList p = paths;
     QMutableListIterator<QString> it(p);
     while (it.hasNext()) {
@@ -404,7 +425,13 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
             thread = *jt;
             QMutexLocker locker(&(thread->mutex));
 
+            qDebug() << "Looking for " <<  absolutePath << flags
+            << "Before " << thread;
+
             handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath));
+            qDebug() << "handle match" << (handle.handle != INVALID_HANDLE_VALUE)
+                        << "flag match" <<  (handle.flags == flags)
+                        << handle.flags << flags;
             if (handle.handle != INVALID_HANDLE_VALUE && handle.flags == flags) {
                 // found a thread now insert...
                 DEBUG() << "Found a thread" << thread;
@@ -419,6 +446,8 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
                     else
                         files->append(path);
                 }
+                qDebug() << "Inserted" << thread;
+
                 it.remove();
                 thread->wakeup();
                 break;
@@ -448,12 +477,12 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
                     thread->handles.append(handle.handle);
                     thread->handleForDir.insert(QFileSystemWatcherPathKey(absolutePath), handle);
 
-                    thread->pathInfoForHandle[handle.handle].insert(QFileSystemWatcherPathKey(fileInfo.absoluteFilePath()), pathInfo);
+                   thread->pathInfoForHandle[handle.handle].insert(QFileSystemWatcherPathKey(fileInfo.absoluteFilePath()), pathInfo);
+                   qDebug() << "Added handle" << handle << thread;
                     if (isDir)
                         directories->append(path);
                     else
                         files->append(path);
-
                     it.remove();
                     found = true;
                     thread->wakeup();
@@ -491,6 +520,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
             m_driveListener->addPath(path);
     }
 #endif // !Q_OS_WINRT
+    DEBUG() << __FUNCTION__ << "<" << paths << '\n';
     return p;
 }
 
@@ -498,7 +528,8 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
                                                           QStringList *files,
                                                           QStringList *directories)
 {
-    DEBUG() << "removePaths" << paths;
+    DEBUG() << __FUNCTION__ << '>' << paths
+            << *files << *directories;
     QStringList p = paths;
     QMutableListIterator<QString> it(p);
     while (it.hasNext()) {
@@ -507,11 +538,12 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
         if (normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\')))
             normalPath.chop(1);
         QFileInfo fileInfo(normalPath);
-        DEBUG() << "removing" << normalPath;
+        DEBUG() << "removing" << normalPath << fileInfo.absoluteFilePath();
         QString absolutePath = fileInfo.absoluteFilePath();
         QList<QWindowsFileSystemWatcherEngineThread *>::iterator jt, end;
         end = threads.end();
         for(jt = threads.begin(); jt!= end; ++jt) {
+            qDebug() << __FUNCTION__ << fileInfo.absolutePath();
             QWindowsFileSystemWatcherEngineThread *thread = *jt;
             if (*jt == 0)
                 continue;
@@ -520,14 +552,19 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
 
             QWindowsFileSystemWatcherEngine::Handle handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath));
             if (handle.handle == INVALID_HANDLE_VALUE) {
+                qDebug() << "INVALID_HANDLE_VALUE1";
                 // perhaps path is a file?
                 absolutePath = fileInfo.absolutePath();
                 handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath));
+                if (handle.handle == INVALID_HANDLE_VALUE)
+                    qDebug() << "INVALID_HANDLE_VALUE2";
             }
             if (handle.handle != INVALID_HANDLE_VALUE) {
+                qDebug() << "found" << handle << "for" << absolutePath << "in" << thread;
                 QWindowsFileSystemWatcherEngineThread::PathInfoHash &h =
                         thread->pathInfoForHandle[handle.handle];
                 if (h.remove(QFileSystemWatcherPathKey(fileInfo.absoluteFilePath()))) {
+                    qDebug() << "removed PathInfoHash" << h;
                     // ###
                     files->removeAll(path);
                     directories->removeAll(path);
@@ -535,17 +572,24 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
 
                     if (h.isEmpty()) {
                         DEBUG() << "Closing handle" << handle.handle;
-                        FindCloseChangeNotification(handle.handle);    // This one might generate a notification
+                        BOOL r = FindCloseChangeNotification(handle.handle);    // This one might generate a notification
+                        if (r == FALSE)
+                            DEBUG() << "FindCloseChangeNotification fail";
 
                         int indexOfHandle = thread->handles.indexOf(handle.handle);
                         Q_ASSERT(indexOfHandle != -1);
                         thread->handles.remove(indexOfHandle);
 
                         thread->handleForDir.remove(QFileSystemWatcherPathKey(absolutePath));
+
+                        qDebug() << "After removing"  << fileInfo.absoluteFilePath()
+                                 << "with abspath=" << absolutePath << ": "
+                                 << thread;
+
                         // h is now invalid
 
                         if (thread->handleForDir.isEmpty()) {
-                            DEBUG() << "Stopping thread " << thread;
+                            DEBUG() << "Stopping thread " << thread << "no handle for" << absolutePath;
                             locker.unlock();
                             thread->stop();
                             thread->wait();
@@ -572,6 +616,7 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path
     }
 
     threads.removeAll(0);
+    DEBUG() << __FUNCTION__ << '<' << paths << '\n';
     return p;
 }
 
