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

QFileSytemWatcher cannot have thread affinity changed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.9.4
    • None
    • This is running on a windows 10 system with Qt 5.9.4 msvc 2015 64 / 32 bit. 
    • Windows

    Description

      Creating a QFileSystemWatcher and then later calling QObject::moveToThread() on it or a parent will cause a crash when it is later deleted. This seems like it may be related to https://bugreports.qt.io/browse/QTBUG-64171 

       

      A minimal example of this is 

       

      #include <QApplication>
      #include <QMessageBox>
      #include <QFileSystemWatcher>
      #include <QThread>
      
      int main(int argc, char *argv[])
      {
        QApplication a(argc, argv);
        QThread thread;
        thread.start();
        QFileSystemWatcher *watcher = new QFileSystemWatcher();
        watcher->moveToThread(&thread);
        QMessageBox box;
        box.show();
      
        watcher->deleteLater();
        return a.exec();
      }
      

       

       

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jackroache Jack Roache
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes