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

QFileSytemWatcher cannot have thread affinity changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical 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

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

       

       

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

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

              Created:
              Updated:

                There are no open Gerrit changes