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>
This commit is contained in:
Hugo Parente Lima 2011-04-27 17:51:52 -03:00
commit 3bb2bf375e
3 changed files with 31 additions and 2 deletions

View file

@ -154,7 +154,7 @@ void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds)
QByteArray className(PyString_AS_STRING(PyTuple_GET_ITEM(args, 0))); QByteArray className(PyString_AS_STRING(PyTuple_GET_ITEM(args, 0)));
PyObject* bases = PyTuple_GET_ITEM(args, 1); PyObject* bases = PyTuple_GET_ITEM(args, 1);
int numBases = PyTuple_GET_SIZE(args); int numBases = PyTuple_GET_SIZE(bases);
QMetaObject* baseMo = 0; QMetaObject* baseMo = 0;
for (int i = 0; i < numBases; ++i) { 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* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name)
{ {
PyObject* attr = PyObject_GenericGetAttr(self, 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; return attr;
if (attr && Property::isPropertyType(attr)) { if (attr && Property::isPropertyType(attr)) {

View file

@ -54,6 +54,7 @@ PYSIDE_TEST(bug_750.py)
PYSIDE_TEST(bug_778.py) PYSIDE_TEST(bug_778.py)
PYSIDE_TEST(bug_793.py) PYSIDE_TEST(bug_793.py)
PYSIDE_TEST(bug_811.py) PYSIDE_TEST(bug_811.py)
PYSIDE_TEST(bug_836.py)
PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py)

28
tests/QtGui/bug_836.py Normal file
View file

@ -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()