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?