diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-02-17 11:17:34 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-02-20 09:20:27 +0100 |
commit | 96e016d95d8e37eb76492ab45dc454767ccb21b6 (patch) | |
tree | a8bdf4071fc48ec746666aa78a8cb96e9fd5f3c3 /sources/pyside6/libpyside/qobjectconnect.cpp | |
parent | dc7165e366692296170fbb367e631b760098bc85 (diff) |
Fix disconnecting a string-based connection by passing a callable
Amends cab304e70cce68bbdaa70d7f7b2bf6e95e85e6d2.
Restructure the test.
Pick-to: 6.8
Fixes: PYSIDE-3020
Task-number: PYSIDE-1057
Change-Id: I8954a534648ded5d476fec608d0699132a026461
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 | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/qobjectconnect.cpp b/sources/pyside6/libpyside/qobjectconnect.cpp index 654b974da..03644ed84 100644 --- a/sources/pyside6/libpyside/qobjectconnect.cpp +++ b/sources/pyside6/libpyside/qobjectconnect.cpp @@ -274,8 +274,15 @@ bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObject *ca if (signalIndex == -1) return false; - if (!disconnectSlot(source, signalIndex, callback)) - return false; + if (!disconnectSlot(source, signalIndex, callback)) { + // PYSIDE-3020: Check for disconnecting a string-based connection by passing a callable? + auto receiver = getReceiver(metaObject->method(signalIndex), callback); + if (receiver.receiver == nullptr || receiver.slotIndex == -1 + || !QMetaObject::disconnect(source, signalIndex, + receiver.receiver, receiver.slotIndex)) { + return false; + } + } const QMetaMethod signalMethod = metaObject->method(signalIndex); static_cast<FriendlyQObject *>(source)->disconnectNotify(signalMethod); |