QFileSystemWatcher QDir::remove locking



  • According to QFileSystemWatcher it will emit it's directoryChanged signal when a path is removed, which it does ... sort of. It emits the signal but the folder is not reporting that it has been removed using QDir::exists. If I try browsing to the folder with windows explorer it shows the directory but gives me an access denied if I try entering it. I'm running Windows 7 x64 btw. To test if QFileSystemWatcher was locking it I put together this quick sample:

    @
    QDir dir("c:/temp");
    qDebug() << "mkpath test1/test2/test3" << dir.mkpath("test1/test2/test3");
    QFileSystemWatcher watch(QStringList() << dir.absoluteFilePath("test1") << dir.absoluteFilePath("test1/test2") << dir.absoluteFilePath("test1/test2/test3"));
    qDebug() << "rmdir - test1/test2/test3" << dir.rmdir("test1/test2/test3");
    qDebug() << "rmdir - test1/test2" << dir.rmdir("test1/test2");
    qDebug() << "rmdir - test1" << dir.rmdir("test1");

    @

    Which outputs...

    @
    mkpath test1/test2/test3 true
    rmdir - test1/test2/test3 true
    QFileSystemWatcher: FindNextChangeNotification failed!! (Access is denied.)
    rmdir - test1/test2 false
    rmdir - test1 false
    @

    If I comment out the QFileSystemWatcher line then all the folders are removed successfully or if I remove the paths from the QFileSystemWatcher before I delete them then it will also succeed. What confuses me is that the docs say "Note that QFileSystemWatcher stops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk.". I was hoping to use QFileSystemWatcher to be my notifier when directories were removed, otherwise I have to build my own hooks to notify the "watcher" when things have changed. Any ideas?

    Thanks.



  • I am currently using Qt 5.0.2 on Windows 7 64 bits and I am experiencing the same issue.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.