diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 42bf9eeca3..10c00e2a67 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -769,6 +769,18 @@ void tst_QCoreApplication::testQuitLock() app.exec(); } +static void createQObjectOnDestruction() +{ + // Make sure that we can create a QObject after the last QObject has been + // destroyed (especially after QCoreApplication has). + // + // Before the fixes, this would cause a dangling pointer dereference. If + // the problem comes back, it's possible that the following causes no + // effect. + QObject obj; + obj.thread()->setProperty("testing", 1); +} +Q_DESTRUCTOR_FUNCTION(createQObjectOnDestruction) QTEST_APPLESS_MAIN(tst_QCoreApplication) #include "tst_qcoreapplication.moc" |