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:
Renato Filho 2010-08-16 12:07:12 -03:00
commit 2d24d300d8
2 changed files with 21 additions and 11 deletions

View file

@ -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;
}