diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 10:49:13 +0100 |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 12:24:43 +0200 |
commit | 84c3b3e32612149d128d5288aebdf27badb8d43c (patch) | |
tree | 055d676266afc6393da83d8944feca1ede8aa145 /tests | |
parent | 62cfd18376a52b99516451e9dcaee6d123091b89 (diff) |
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')
-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 8e0c9fe10a..9d46a8d863 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; @@ -550,5 +552,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" |