Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.8.4
-
None
-
Windows XP (32bit), NTFS
Description
removePath("C:/test") fails if its child file, e.g. "C:/test/file", has been added.
And the directory no longer be watched again.
Example:
QFileSystemWatcher watcher; qDebug() << "==== add ===="; watcher.addPath("C:/test"); watcher.addPath("C:/test/file"); qDebug() << "watching:" << watcher.files() << watcher.directories(); qDebug() << "==== remove ===="; watcher.removePath("C:/test"); watcher.removePath("C:/test/file"); qDebug() << "watching:" << watcher.files() << watcher.directories(); // still "C:/test" is included in watcher.directories(), but it seems not // actually watched. qDebug() << "==== add again ===="; watcher.addPath("C:/test"); // fails watcher.addPath("C:/test/file"); qDebug() << "watching:" << watcher.files() << watcher.directories();
Output:
Z:\work\qfswatchwinbug>debug\qfswatchwinbug.exe ==== add ==== watching: ("C:/test/file") ("C:/test") ==== remove ==== watching: () ("C:/test") ==== add again ==== QFileSystemWatcher: failed to add paths: C:/test watching: ("C:/test/file") ("C:/test")
I suspect that the existing thread->handleForDir[absolutePath] (where absolutePath = "C:/test") is overwritten by addPath("C:/test/file") because flags is different.
http://qt.gitorious.org/qt/qt/blobs/4.8/src/corelib/io/qfilesystemwatcher_win.cpp#line179
Hope this helps.