[PyQt] Re: memory corruption storing python objects in a QModelIndex with createIndex

Erick Tryzelaar idadesub at users.sourceforge.net
Thu Oct 2 03:10:47 BST 2008


Thanks Andreas. I fixed your suggestions, plus i shuffled some stuff
around and I think I got it to work. In the meantime, I think I found
a bug in modeltest. This is the simplest model I could come up with:


class Model(QStringListModel):
    pass

def main():
    app = QCoreApplication(sys.argv)

    model = Model(['a', 'b'])
    test = modeltest.ModelTest(model, app)

main()


But it throws this exception:


Traceback (most recent call last):
  File "foo2.py", line 17, in ?
    main()
  File "foo2.py", line 15, in main
    test = modeltest.ModelTest(model, app)
  File "/home/erickt/downloads/PyQt-x11-gpl-4.4.4-snapshot-20080928/contrib/pymodeltest/modeltest.py",
line 60, in __init__
    self.runAllTests()
  File "/home/erickt/downloads/PyQt-x11-gpl-4.4.4-snapshot-20080928/contrib/pymodeltest/modeltest.py",
line 295, in runAllTests
    self.parent()
  File "/home/erickt/downloads/PyQt-x11-gpl-4.4.4-snapshot-20080928/contrib/pymodeltest/modeltest.py",
line 222, in parent
    self.checkChildren(QtCore.QModelIndex())
  File "/home/erickt/downloads/PyQt-x11-gpl-4.4.4-snapshot-20080928/contrib/pymodeltest/modeltest.py",
line 412, in checkChildren
    assert( index.model() == self.model )
AssertionError


I've commented it out and modeltest didn't complain about any other
bugs, so that's good.


More information about the PyQt mailing list