summaryrefslogtreecommitdiffstats
path: root/tests/auto/qobject/tst_qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qobject/tst_qobject.cpp')
-rw-r--r--tests/auto/qobject/tst_qobject.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index d2307ee..4b926e4 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -135,7 +135,7 @@ private slots:
void disconnectByMetaMethod();
void disconnectNotSignalMetaMethod();
void autoConnectionBehavior();
-
+ void baseDestroyed();
protected:
};
@@ -3925,5 +3925,34 @@ void tst_QObject::autoConnectionBehavior()
delete receiver;
}
+class BaseDestroyed : public QObject
+{ Q_OBJECT
+ QList<QString> fooList;
+ bool destroyed;
+public:
+ BaseDestroyed() : destroyed(false)
+ { fooList << "a" << "b"; }
+ ~BaseDestroyed()
+ {
+ QVERIFY(!destroyed);
+ destroyed = true;
+ }
+
+public slots:
+ void slotUseList()
+ {
+ QVERIFY(!destroyed);
+ fooList << "c" << "d";
+ }
+};
+
+void tst_QObject::baseDestroyed()
+{
+ BaseDestroyed d;
+ connect(&d, SIGNAL(destroyed()), &d, SLOT(slotUseList()));
+ //When d goes out of scope, slotUseList should not be called as the BaseDestroyed has
+ // already been destroyed while ~QObject emit destroyed
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"