From 105490ccd31ae2eed54c5512b20467a1d2f88a01 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 19 Nov 2021 10:28:39 +0100 Subject: PySide6: Fix crash when connecting slot after disconnecting non-existent connection to same slot Add a null-check. Fixes: PYSIDE-1715 Change-Id: I0fc8c1b051b04eacd6bd75542ceaf9f23a825cab Reviewed-by: Cristian Maureira-Fredes (cherry picked from commit 360ef4e884db56e3cd228593bbc562727fbd41cd) Reviewed-by: Qt Cherry-pick Bot --- sources/pyside6/libpyside/globalreceiverv2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp index c935d1180..0fe67db37 100644 --- a/sources/pyside6/libpyside/globalreceiverv2.cpp +++ b/sources/pyside6/libpyside/globalreceiverv2.cpp @@ -299,8 +299,10 @@ void GlobalReceiverV2::notify() const QSet objSet(m_refs.cbegin(), m_refs.cend()); Py_BEGIN_ALLOW_THREADS for (const QObject *o : objSet) { - QMetaObject::disconnect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); - QMetaObject::connect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + if (o) { + QMetaObject::disconnect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + QMetaObject::connect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + } } Py_END_ALLOW_THREADS } -- cgit v1.2.3