summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp')
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 064f780546..c17d81ea9e 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -72,6 +72,7 @@ private slots:
void singleShotStaticFunctionZeroTimeout();
void recurseOnTimeoutAndStopTimer();
void singleShotToFunctors();
+ void crossThreadSingleShotToFunctor();
void dontBlockEvents();
void postedEventsShouldNotStarveTimers();
@@ -877,5 +878,28 @@ void tst_QTimer::postedEventsShouldNotStarveTimers()
QVERIFY(timerHelper.count > 5);
}
+struct DummyFunctor {
+ void operator()() {}
+};
+
+void tst_QTimer::crossThreadSingleShotToFunctor()
+{
+ // We're testing for crashes here, so the test simply running to
+ // completion is considered a success
+ QThread t;
+ t.start();
+
+ QObject* o = new QObject();
+ o->moveToThread(&t);
+
+ for (int i = 0; i < 10000; i++) {
+ QTimer::singleShot(0, o, DummyFunctor());
+ }
+
+ t.quit();
+ t.wait();
+ delete o;
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"