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

QFileSytemWatcher cannot have thread affinity changed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.9.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      This is running on a windows 10 system with Qt 5.9.4 msvc 2015 64 / 32 bit. 

      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

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

          Activity

            People

            • Assignee:
              thiago Thiago Macieira
              Reporter:
              jackroache Jack Roache
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes