aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-19 10:28:39 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-19 22:04:38 +0100
commit360ef4e884db56e3cd228593bbc562727fbd41cd (patch)
treeb14cee4fb2ef51fa8c468c01a996359d18e73de5
parentddab4c862af610417eeb8e1510f3ff20aaa9d57c (diff)
PySide6: Fix crash when connecting slot after disconnecting non-existent connection to same slot
Add a null-check. Fixes: PYSIDE-1715 Pick-to: 6.2 5.15 Change-Id: I0fc8c1b051b04eacd6bd75542ceaf9f23a825cab Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside6/libpyside/globalreceiverv2.cpp6
1 files 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<const QObject *> 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
}