diff options
-rw-r--r-- | libpyside/qsignal.cpp | 2 | ||||
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/qobject_objectproperty_test.py | 29 |
3 files changed, 31 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); diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 76db54f25..210aa01de 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -34,6 +34,7 @@ PYSIDE_TEST(qobject_connect_notify_test.py) PYSIDE_TEST(qobject_destructor.py) PYSIDE_TEST(qobject_event_filter_test.py) PYSIDE_TEST(qobject_inherits_test.py) +PYSIDE_TEST(qobject_objectproperty_test.py) PYSIDE_TEST(qobject_parent_test.py) PYSIDE_TEST(qobject_property_test.py) PYSIDE_TEST(qobject_protected_methods_test.py) diff --git a/tests/QtCore/qobject_objectproperty_test.py b/tests/QtCore/qobject_objectproperty_test.py new file mode 100644 index 000000000..2456b82cf --- /dev/null +++ b/tests/QtCore/qobject_objectproperty_test.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +'''Test case for the bug #378 +http://bugs.openbossa.org/show_bug.cgi?id=378 +''' + +import unittest +from PySide.QtCore import QObject + +class ExtQObject(QObject): + def __init__(self): + # "foobar" will become a object attribute that will not be + # listed on the among the type attributes. Thus for bug + # condition be correctly triggered the "foobar" attribute + # must not previously exist in the parent class. + self.foobar = None + # The parent __init__ method must be called after the + # definition of "self.foobar". + QObject.__init__(self) + +class TestBug378(unittest.TestCase): + '''Test case for the bug #378''' + + def testBug378(self): + obj = ExtQObject() + +if __name__ == '__main__': + unittest.main() + |