aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-10-27 11:40:12 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-27 13:12:29 +0000
commitae31d6c7cbc847a93aadb521b6112b6238474a0a (patch)
treea50854198c80fc02ea1bdfd104448e3dbab3ddf6
parenta8a4f66c9c7a50df1037c926b0074ba09394af1b (diff)
Set error when instantiating a Signal on a non-QObject
Fixes: PYSIDE-2510 Pick-to: 6.5 Change-Id: Icc1461299907cc116bc75f5de994a687b85c1786 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> (cherry picked from commit 2a1034684b23f526631dd9d9e85a39f5bd3b71dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside6/libpyside/pysidesignal.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp
index 687eb400e..b61ade1f5 100644
--- a/sources/pyside6/libpyside/pysidesignal.cpp
+++ b/sources/pyside6/libpyside/pysidesignal.cpp
@@ -733,7 +733,8 @@ static PyObject *signalDescrGet(PyObject *self, PyObject *obj, PyObject * /*type
{
auto signal = reinterpret_cast<PySideSignal *>(self);
// Return the unbound signal if there is nothing to bind it to.
- if (obj == nullptr || obj == Py_None) {
+ if (obj == nullptr || obj == Py_None
+ || !PySide::isQObjectDerived(Py_TYPE(obj), true)) {
Py_INCREF(self);
return self;
}