aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-10-13 11:09:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-13 16:15:00 +0000
commit9d3ee797a2ea6f5781f8b2b16922e21bdb2d3b26 (patch)
tree6c021d6ab7e63f9c5907a7e1f8f38733b110a5b7
parent6a50ae5ff55ed81885ce0dd4bbdcc3217f553fef (diff)
Fix disconnecting non-decorated slot of base class from signal
Further tighten the check for non-virtual slots overwritten in Python by checking that the QMetaObject actually returns a different declaring class. This works around the underlying issue that the logic automatically creating meta methods for non-decorated slots wrongly adds the entry to the derived class. Amends f048d13b4f042b04d94007fba951ed3080ccf8c9. Task-number: PYSIDE-2418 Fixes: PYSIDE-2487 Change-Id: I0c62cfd9fd6dcb2ddf6bcfd1db14aa274293b34f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit a8f7ee7534a44be5674ef0e68c725651cb6c418c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit d3d4973ef38de66cc5f822aedc2c373b9df54590)
-rw-r--r--sources/pyside6/libpyside/qobjectconnect.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/pyside6/libpyside/qobjectconnect.cpp b/sources/pyside6/libpyside/qobjectconnect.cpp
index de6f74b14..e0b146e06 100644
--- a/sources/pyside6/libpyside/qobjectconnect.cpp
+++ b/sources/pyside6/libpyside/qobjectconnect.cpp
@@ -132,7 +132,8 @@ static GetReceiverResult getReceiver(QObject *source, const char *signal,
result.usingGlobalReceiver).toLatin1();
const QMetaObject *metaObject = result.receiver->metaObject();
result.slotIndex = metaObject->indexOfSlot(result.callbackSig.constData());
- if (PyMethod_Check(callback) != 0 && result.slotIndex != -1) {
+ if (PyMethod_Check(callback) != 0 && result.slotIndex != -1
+ && result.slotIndex < metaObject->methodOffset()) {
// Find the class in which the slot is declared.
while (result.slotIndex < metaObject->methodOffset())
metaObject = metaObject->superClass();