diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-11-19 10:28:39 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-11-19 22:23:14 +0000 |
commit | 105490ccd31ae2eed54c5512b20467a1d2f88a01 (patch) | |
tree | 509e28d75d731a95ccf793ecef026bc5de7daf79 | |
parent | 1c1134fe90e9f185ab4b052a829dd8bf5ff0e0e8 (diff) |
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 <cristian.maureira-fredes@qt.io>
(cherry picked from commit 360ef4e884db56e3cd228593bbc562727fbd41cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/libpyside/globalreceiverv2.cpp | 6 |
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 } |