summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-02-04 15:54:25 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-02-06 17:20:17 +0000
commite1ce71572446e68bcd78fd37a061b7f32d40bd00 (patch)
tree34d01fc6f4f7545a85330827b763d72a8d123ab2
parent97df448edbc035a2f531508a5cfe5739fb2de18d (diff)
Add pyObj check to setSequenceOwnership
Ownership is always set recursively, so for each element we check the children of the object. When we don't have any, and also no parent the mechanism we have fails, so for constructors that allow having a null parent, we need to just skip this function. Change-Id: Iee6a81409cad7dd08c6ecbafd1b11c9a7bb0db85 Fixes: PYSIDE-922 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index 3e1a7e8e..8fe4710d 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -844,6 +844,10 @@ static void setSequenceOwnership(PyObject* pyObj, bool owner)
{
bool has_length = true;
+
+ if (!pyObj)
+ return;
+
if (PySequence_Size(pyObj) < 0) {
PyErr_Clear();
has_length = false;