diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 09:49:13 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-22 14:09:07 (GMT) |
commit | 9036fe3d2ffabde9b49ced0ba8835d8403b11ff4 (patch) | |
tree | d972f72c37b2c3ae7a5f8d0a0e104b208a9c7c61 /tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | |
parent | 39f2dc87dbec95934cb4596c46f8b17994048de2 (diff) | |
download | Qt-9036fe3d2ffabde9b49ced0ba8835d8403b11ff4.zip Qt-9036fe3d2ffabde9b49ced0ba8835d8403b11ff4.tar.gz Qt-9036fe3d2ffabde9b49ced0ba8835d8403b11ff4.tar.bz2 |
QFileSystemWatcher: Do not require QApplication in the destructor.
QThread::quit() is threadsafe, and can safely (and should) be called
from the parent thread.
Using invokeMethod requires an instance of QCoreApplication. There
is no reason we should depend on that.
Task-number: QTBUG-15255
Task-number: QT-3305
Reviewed-by: Denis
Reviewed-by: Brad
Diffstat (limited to 'tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp')
-rw-r--r-- | tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a26e34d..fd898ee 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -82,6 +82,8 @@ private slots: void removeFileAndUnWatch(); void cleanup(); + + void QTBUG15255_deadlock(); private: QStringList do_force_engines; bool do_force_native; @@ -557,5 +559,23 @@ void tst_QFileSystemWatcher::removeFileAndUnWatch() watcher.addPath(filename); } +class SomeSingleton : public QObject +{ +public: + SomeSingleton() : mFsWatcher(new QFileSystemWatcher(this)) { mFsWatcher->addPath(QLatin1String("/usr/lib"));} + void bla() const {} + QFileSystemWatcher* mFsWatcher; +}; + +Q_GLOBAL_STATIC(SomeSingleton, someSingleton) + +void tst_QFileSystemWatcher::QTBUG15255_deadlock() +{ + someSingleton()->bla(); + //the test must still finish + QTest::qWait(30); +} + + QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" |