From e1ce71572446e68bcd78fd37a061b7f32d40bd00 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Mon, 4 Feb 2019 15:54:25 +0100 Subject: 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 --- sources/shiboken2/libshiboken/basewrapper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index 3e1a7e8e5..8fe4710dd 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; -- cgit v1.2.3