diff options
Diffstat (limited to 'tests/auto/qobject/tst_qobject.cpp')
-rw-r--r-- | tests/auto/qobject/tst_qobject.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index c8f846e..0161a68 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -2835,6 +2835,16 @@ void tst_QObject::installEventFilter() QVERIFY(spy.eventList().isEmpty()); } +class EmitThread : public QThread +{ Q_OBJECT +public: + void run(void) { + emit work(); + } +signals: + void work(); +}; + class DeleteObject : public QObject { Q_OBJECT @@ -2900,6 +2910,16 @@ void tst_QObject::deleteSelfInSlot() QVERIFY(thread.wait(10000)); } + + { + EmitThread sender; + DeleteObject *receiver = new DeleteObject(); + connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection); + QPointer<DeleteObject> p = receiver; + sender.start(); + QVERIFY(sender.wait(10000)); + QVERIFY(p.isNull()); + } } class DisconnectObject : public QObject |