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

QFileSystemWatcher* hangs with QCoreApplication parent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 4.7.1
    • None
    • Ubuntu 9.10

    Description

      Came across a situation like this:

      int main(int argc, char *argv[])
      {
          QCoreApplication app(argc, argv);
          const QString filename("test.file");
          QFileSystemWatcher* watcher = new QFileSystemWatcher(&app);
          watcher->addPaths(QStringList(filename));
          QTimer::singleShot(1000, &app, SLOT(quit()));
          return app.exec();
      }
      

      The application deadlocks, since QFileSystemWatcher needs QCoreApplication to stop, but QCoreApplication is already destroyed at that point.

      Not using new (QFileSystemWatcher watcher(&app) or just not passing
      app as watcher's parent works.

      The first method works if QInotifyFileSystemWatcherEngine::stop() is
      modified to use quit(); instead of QMetaObject::invokeMethod(this,
      "quit");. Application seems to quit cleanly, but maybe it breaks something else?

      Attachments

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

        Activity

          People

            dzyubenk Denis Dzyubenko (Inactive)
            kko Kimmo Kotajärvi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes