diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-14 16:29:13 +1000 |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-14 16:29:13 +1000 |
commit | 0c831b8cf84c72ee8673d1d38f4e93e350dddd5f (patch) | |
tree | 84fc3c89d73342ec70d77b2bdf99066f987536b8 /tests/auto/qsharedpointer/tst_qsharedpointer.cpp | |
parent | b98b7d305ffebb700e471bd64a7dee59d947e056 (diff) | |
parent | 4b1b93f3f97de70af316052bc38048f52631b9e4 (diff) |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests/auto/qsharedpointer/tst_qsharedpointer.cpp')
-rw-r--r-- | tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 516729cb8..58e5401be 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -1593,6 +1593,21 @@ void tst_QSharedPointer::invalidConstructs_data() << "QObject *ptr = new QObject;\n" "QWeakPointer<QObject> weak = ptr;\n" // this makes the object unmanaged "QSharedPointer<QObject> shared(ptr);\n"; + +#ifndef QT_NO_DEBUG + // this tests a Q_ASSERT, so it is only valid in debug mode + // the DerivedFromQObject destructor below creates a QWeakPointer from parent(). + // parent() is not 0 in the current Qt implementation, but has started destruction, + // so the code should detect that issue + QTest::newRow("shared-pointer-from-qobject-in-destruction") + << &QTest::QExternalTest::tryRunFail + << "class DerivedFromQObject: public QObject { public:\n" + " DerivedFromQObject(QObject *parent): QObject(parent) {}\n" + " ~DerivedFromQObject() { QWeakPointer<QObject> weak = parent(); }\n" + "};\n" + "QObject obj;\n" + "new DerivedFromQObject(&obj);"; +#endif } void tst_QSharedPointer::invalidConstructs() |