diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-13 11:09:49 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-13 12:42:17 +0200 |
commit | a8f7ee7534a44be5674ef0e68c725651cb6c418c (patch) | |
tree | 91ef2cddf32a84ec32b4afd4f1aafa45ade9fc6a /sources/pyside6/libpyside/qobjectconnect.cpp | |
parent | 88e664e049a07fbb337e593cbc307124f2f8b71a (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
Pick-to: 6.6 6.5
Change-Id: I0c62cfd9fd6dcb2ddf6bcfd1db14aa274293b34f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/qobjectconnect.cpp')
-rw-r--r-- | sources/pyside6/libpyside/qobjectconnect.cpp | 3 |
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(); |