diff options
Diffstat (limited to 'tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp')
-rw-r--r-- | tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 403e500d8c..cd23f2cb47 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -1012,8 +1012,14 @@ void tst_QDBusAbstractInterface::followSignal() QVERIFY(!con.interface()->isServiceRegistered(serviceToFollow)); Pinger control = getPinger(""); - // we need to connect the signal somewhere in order for D-Bus to enable the rules - QTestEventLoop::instance().connect(p.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + // connect our test signal + // FRAGILE CODE AHEAD: + // Connection order is important: we connect the control first because that + // needs to be delivered last, to ensure that we don't exitLoop() before + // the signal delivery to QSignalSpy is posted to the current thread. That + // happens because QDBusConnectionPrivate runs in a separate thread and + // uses a QMultiHash and insertMulti prepends to the list of items with the + // same key. QTestEventLoop::instance().connect(control.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); QSignalSpy s(p.data(), SIGNAL(voidSignal())); |