diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-10-19 22:01:33 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-10-21 10:13:25 +0200 |
commit | e7c2b6ea1645065a64c2385498e7bd452e47c1ec (patch) | |
tree | d816727d6ec7c61a3560e58826f942e63d39be4a /sources/pyside6/libpyside/dynamicslot.cpp | |
parent | bdd6a0d5d61aa76c202669ae1c17ef4dfe0b9bde (diff) |
Fix error handling in non-slot connection receivers
Extract the error handling code which existed duplicated in
GlobalReceiverV2::qt_metacall() and
SignalManagerPrivate::handleMetaCallError() as a static helper of
SignalManager and call that from the DynamicSlot functions.
Amends 33bd61d13d8d9e3794b6049891be62f3351313d9.
Pick-to: 6.8 6.8.0
Task-number: PYSIDE-2810
Fixes: PYSIDE-2900
Change-Id: Ife9f156e6752dde7002218d36d369ba68ad595b0
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/libpyside/dynamicslot.cpp')
-rw-r--r-- | sources/pyside6/libpyside/dynamicslot.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/dynamicslot.cpp b/sources/pyside6/libpyside/dynamicslot.cpp index ce8ed191c..1fbdba1ab 100644 --- a/sources/pyside6/libpyside/dynamicslot.cpp +++ b/sources/pyside6/libpyside/dynamicslot.cpp @@ -65,6 +65,10 @@ void CallbackDynamicSlot::call(const QByteArrayList ¶meterTypes, const char void **cppArgs) { SignalManager::callPythonMetaMethod(parameterTypes, returnType, cppArgs, m_callback); + // SignalManager::callPythonMetaMethod might have failed, in that case we have to print the + // error so it considered "handled". + if (PyErr_Occurred() != nullptr) + SignalManager::handleMetaCallError(); } void CallbackDynamicSlot::formatDebug(QDebug &debug) const @@ -116,6 +120,10 @@ void MethodDynamicSlot::call(const QByteArrayList ¶meterTypes, const char *r m_pythonSelf, nullptr)); SignalManager::callPythonMetaMethod(parameterTypes, returnType, cppArgs, callable.object()); + // SignalManager::callPythonMetaMethod might have failed, in that case we have to print the + // error so it considered "handled". + if (PyErr_Occurred() != nullptr) + SignalManager::handleMetaCallError(); } void MethodDynamicSlot::formatDebug(QDebug &debug) const |