diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-24 15:47:41 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-24 16:03:58 -0300 |
commit | dedc78b3fef25e04cf436ca462714ad8dc0329cd (patch) | |
tree | f679cfcc9ef848330c79410e7fda5493d24bc679 /libpyside | |
parent | 16579322f177c1fde0336c2b255a4a696ed73e5d (diff) |
Fixed segmentation fault libpyside's signalUpdateSource function.
This function is called when an object is instantiated, and it will
go through the class attributes looking for signals and what else
is relevant. If the user has set a new attribute in the constructor
before the call to its parent QObject-like __init__ method, a
segmentation fault would ensue.
This commit fixes this condition and also adds an unit test.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libpyside')
-rw-r--r-- | libpyside/qsignal.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index aa218eccd..95fc25198 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -225,7 +225,7 @@ void signalUpdateSource(PyObject* source) for(int i = 0, iMax = PyList_GET_SIZE(attrs.object()); i < iMax; ++i) { PyObject *attrName = PyList_GET_ITEM(attrs.object(), i); Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast<PyObject*>(source->ob_type), attrName)); - if (attr->ob_type == &Signal_Type) { + if (!attr.isNull() && attr->ob_type == &Signal_Type) { Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(SignalInstanceData, &SignalInstance_Type)); signal_instance_initialize(signalInstance, attrName, reinterpret_cast<SignalData*>(attr.object()), source, 0); PyObject_SetAttr(source, attrName, signalInstance); |