diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-04-27 17:51:52 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:15 -0300 |
commit | 3bb2bf375e52006c4880aff88f20344f5ccf1f87 (patch) | |
tree | b22932164ad801c95890af8d59d13ff8ff595c7d | |
parent | c4225d063d7e78c6a761004745ccda4cf5188860 (diff) |
Fix bug 836 - "Pyside crashes with more than four base classes"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
-rw-r--r-- | libpyside/pyside.cpp | 4 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/bug_836.py | 28 |
3 files changed, 31 insertions, 2 deletions
diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index a135692bf..4b1c17b6a 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -154,7 +154,7 @@ void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds) QByteArray className(PyString_AS_STRING(PyTuple_GET_ITEM(args, 0))); PyObject* bases = PyTuple_GET_ITEM(args, 1); - int numBases = PyTuple_GET_SIZE(args); + int numBases = PyTuple_GET_SIZE(bases); QMetaObject* baseMo = 0; for (int i = 0; i < numBases; ++i) { @@ -230,7 +230,7 @@ void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds) PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name) { PyObject* attr = PyObject_GenericGetAttr(self, name); - if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject*>(self), false)) + if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject*>(self), false)) return attr; if (attr && Property::isPropertyType(attr)) { diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 2789016af..ff0ce6895 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -54,6 +54,7 @@ PYSIDE_TEST(bug_750.py) PYSIDE_TEST(bug_778.py) PYSIDE_TEST(bug_793.py) PYSIDE_TEST(bug_811.py) +PYSIDE_TEST(bug_836.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_836.py b/tests/QtGui/bug_836.py new file mode 100644 index 000000000..b7d064523 --- /dev/null +++ b/tests/QtGui/bug_836.py @@ -0,0 +1,28 @@ +from PySide.QtCore import * +from PySide.QtGui import * + +class Mixin1(object): + pass + +class Mixin2(object): + pass + +class Mixin3(object): + pass + +class MainWindow(Mixin1, Mixin2, Mixin3, QFrame): + def __init__(self): + super(MainWindow, self).__init__() + +def main(): + app = QApplication([]) + # if it doesn't crash it should pass + w = MainWindow() + w.show() + QTimer.singleShot(0, w.close) + app.exec_() + +if __name__ == "__main__": + main() + + |