summaryrefslogtreecommitdiffstats
path: root/tests/auto/qobject
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-01 15:21:14 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2010-03-01 15:36:35 +0100
commit65f993d679140fb2dc29b48c9d9d8d2fc5af893d (patch)
tree1ca33fb0fb96267e54d292b13302ce0a46764afb /tests/auto/qobject
parentd04f5336f769d9e5d2f9105e1da4a7d23ea91795 (diff)
QObject: fix crash when deleteing the receiver object withing a DirectConncetion involving two threads.
We did not set the sender(), but we tried to reset it anyway. Task-number: QTBUG-7935 Reviewed-by: Brad
Diffstat (limited to 'tests/auto/qobject')
-rw-r--r--tests/auto/qobject/tst_qobject.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 4fa6aaac6c..985dfa43da 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -2647,6 +2647,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
@@ -2712,6 +2722,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