Avoid read the property in the QObject constructor.
Create unit test to verify if the python property is setted during the constructor.
Reviewer: Hugo Parente <hugo.lima@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
6bd528978c
commit
2d24d300d8
2 changed files with 21 additions and 11 deletions
|
|
@ -231,12 +231,14 @@ const char* qproperty_get_type(PyObject* self)
|
|||
|
||||
PyObject* qproperty_get_object(PyObject* source, PyObject* name)
|
||||
{
|
||||
if (PyObject_HasAttr(source, name)) {
|
||||
PyObject* attr = PyObject_GenericGetAttr(source, name);
|
||||
if (isQPropertyType(attr))
|
||||
return attr;
|
||||
PyObject* attr = PyObject_GenericGetAttr(source, name);
|
||||
if (attr && isQPropertyType(attr))
|
||||
return attr;
|
||||
|
||||
if (!attr)
|
||||
PyErr_Clear(); //Clear possible error caused by PyObject_GenericGetAttr
|
||||
else
|
||||
Py_DECREF(attr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue