From c2badc7423b63824902d1f44a4b804de3335c20b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 8 Aug 2014 10:26:03 +0200 Subject: Fix disconnect()ing from signals declared in a base class Fix disconnection from pointer to member signal that belongs to the base class, but whose type is a pointer to a member of the derived class. Commit 9cc106d9d7d951fcf30f4b0f8606afa6b50892ec fixed connect, so apply the same fix in disconnect [ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member signal that belongs in the base class but whose type is explicitly given as a pointer to a member in the derived class Task-number: QTBUG-40638 Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp') diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 1c0a495116..46f034ac84 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6169,6 +6169,18 @@ void tst_QObject::connectBase() QCOMPARE( r1.count_slot1, 1 ); QCOMPARE( r1.count_slot2, 1 ); QCOMPARE( r1.count_slot3, 1 ); + + QVERIFY( QObject::disconnect( &sub, &SubSender::signal1 , &r1, &ReceiverObject::slot1 ) ); + QVERIFY( QObject::disconnect( &sub, static_cast(&SubSender::signal2) , &r1, &ReceiverObject::slot2 ) ); + QVERIFY( QObject::disconnect( &sub, static_cast(&SubSender::signal3) , &r1, &ReceiverObject::slot3 ) ); + + sub.emitSignal1(); + sub.emitSignal2(); + sub.emitSignal3(); + + QCOMPARE( r1.count_slot1, 1 ); + QCOMPARE( r1.count_slot2, 1 ); + QCOMPARE( r1.count_slot3, 1 ); } struct QmlReceiver : public QtPrivate::QSlotObjectBase -- cgit v1.2.3