aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/qobjectconnect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/libpyside/qobjectconnect.cpp')
-rw-r--r--sources/pyside6/libpyside/qobjectconnect.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/qobjectconnect.cpp b/sources/pyside6/libpyside/qobjectconnect.cpp
index e0b146e06..15b71766c 100644
--- a/sources/pyside6/libpyside/qobjectconnect.cpp
+++ b/sources/pyside6/libpyside/qobjectconnect.cpp
@@ -240,7 +240,10 @@ QMetaObject::Connection qobjectConnectCallback(QObject *source, const char *sign
}
}
- auto connection = QMetaObject::connect(source, signalIndex, receiver.receiver, slotIndex, type);
+ QMetaObject::Connection connection{};
+ Py_BEGIN_ALLOW_THREADS // PYSIDE-2367, prevent threading deadlocks with connectNotify()
+ connection = QMetaObject::connect(source, signalIndex, receiver.receiver, slotIndex, type);
+ Py_END_ALLOW_THREADS
if (!connection) {
if (receiver.usingGlobalReceiver)
signalManager.releaseGlobalReceiver(source, receiver.receiver);
@@ -269,7 +272,11 @@ bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObject *ca
const int signalIndex = source->metaObject()->indexOfSignal(signal + 1);
const int slotIndex = receiver.slotIndex;
- if (!QMetaObject::disconnectOne(source, signalIndex, receiver.receiver, slotIndex))
+ bool ok{};
+ Py_BEGIN_ALLOW_THREADS // PYSIDE-2367, prevent threading deadlocks with disconnectNotify()
+ ok = QMetaObject::disconnectOne(source, signalIndex, receiver.receiver, slotIndex);
+ Py_END_ALLOW_THREADS
+ if (!ok)
return false;
Q_ASSERT(receiver.receiver);