aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2023-03-07 11:55:14 +0100
committerChristian Tismer <tismer@stackless.com>2023-03-07 12:09:38 +0100
commit21fbc5ec9a973a80199134db77708b7bc48a0707 (patch)
treeece40e4e77c600599d0bef08c48d52803a1b6e86
parent53e14d6f150cebfd4b0a84335a7d413f4ae72ee3 (diff)
SignalInstance: Fix another very old bug
When a SignalInstance is initialized with wrong arguments, it is immediately deallocated. The deallocation was not aware that certain structures were not initialized. Task-number: PYSIDE-79 Change-Id: I4999bfc3eac1239cfbe8216d5ad574ba17b3ac85 Pick-to: 6.4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/pyside6/libpyside/pysidesignal.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp
index f7c9073c2..291de73d8 100644
--- a/sources/pyside6/libpyside/pysidesignal.cpp
+++ b/sources/pyside6/libpyside/pysidesignal.cpp
@@ -334,15 +334,16 @@ static void signalInstanceFree(void *vself)
auto self = reinterpret_cast<PySideSignalInstance *>(vself);
PySideSignalInstancePrivate *dataPvt = self->d;
+ if (dataPvt) {
+ Py_XDECREF(dataPvt->homonymousMethod);
- Py_XDECREF(dataPvt->homonymousMethod);
-
- if (dataPvt->next) {
- Py_DECREF(dataPvt->next);
- dataPvt->next = nullptr;
+ if (dataPvt->next) {
+ Py_DECREF(dataPvt->next);
+ dataPvt->next = nullptr;
+ }
+ delete dataPvt;
+ self->d = nullptr;
}
- delete dataPvt;
- self->d = nullptr;
self->deleted = true;
Py_TYPE(pySelf)->tp_base->tp_free(self);
}