Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-612

QFileSystemWatcher does not monitor directory if a directory is removed before it has been added

    XMLWordPrintable

Details

    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()

      { qDebug() << "aSlot invoked"; }

      };

      #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();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bhughes Bradley T. Hughes (closed Nokia Identity) (Inactive)
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes