aboutsummaryrefslogtreecommitdiffstats
path: root/libpyside
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-08-16 12:07:12 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-08-16 18:25:54 -0300
commit2d24d300d8ef7e65489051f2f6d3d7d213d4a86a (patch)
tree86843edbf588b292addd414630eccb3cb8380f09 /libpyside
parent6bd528978cad1fe2c0e56cb35b270346da3fbbdd (diff)
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>
Diffstat (limited to 'libpyside')
-rw-r--r--libpyside/qproperty.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp
index b2d011e85..c4b728ac5 100644
--- a/libpyside/qproperty.cpp
+++ b/libpyside/qproperty.cpp
@@ -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;
}