Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.0
-
None
Description
QFileSystemWatcher does not monitor a directory if a directory is removed with QFileSystemWatcher::removePath(Qstring &path) before it has been added to QFileSystemWatcher with QFileSystemWatcher::addPath ( const QString & path ).
It would be expected that a remove of a directory that was not previously added to QFileSystemWatcher did not have any effect. And that monitoring would work as normal when the path was added.
Reproducible with the following example:
#include <QtGui>
#include <QDebug>
class CustomWidget : public QObject
{ Q_OBJECT
public:
CustomWidget(QWidget* parent=0) : QObject(parent)
{ }
public slots:
void aSlot()
};
#include "main.moc"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
CustomWidget wid;
QFileSystemWatcher watcher;
watcher.removePath("/test"); //works as expected if commented out
watcher.addPath("/test");
QObject::connect(&watcher, SIGNAL(directoryChanged(QString)) , &wid, SLOT(aSlot() ) );
return app.exec();
}