[PyKDE] Segfault

Phil Thompson phil at riverbankcomputing.co.uk
Sun Jul 23 10:11:31 BST 2006


On Sunday 23 July 2006 4:36 am, Tobias Rundström wrote:
> Hello list,
>
> The following test program triggers a segfault with PyQt-4.0.1 and Qt
> 4.1.4 on MacOSX 10.4.7
>
> Thanks,
>
> Tobias
>
>
> from PyQt4 import QtCore, QtGui
> import sys
>
> class TreeWidget(QtGui.QTreeWidget):
>          def __init__(self, parent):
>                  QtGui.QTreeWidget.__init__(self, parent)
>                  self.setColumnCount(1)
>                  for u in range(10):
>                          i = QtGui.QTreeWidgetItem(self, [str(u)])
>                          for y in range(10):
>                                  QtGui.QTreeWidgetItem(i, [str(y)])
>                  self.connect(self, QtCore.SIGNAL("itemDoubleClicked
> (QTreeWidgetItem *, int)"), self.dbclick)
>
>          def dbclick(self, item, column):
>                  self.clear()
>                  for y in range(10):
>                          QtGui.QTreeWidgetItem(i, [str(y)])
>
>
> class MainWindow(QtGui.QMainWindow):
>          def __init__(self):
>                  QtGui.QMainWindow.__init__(self)
>                  tree = TreeWidget(self)
>                  self.setCentralWidget(tree)
>                  tree.show()
>
> app = QtGui.QApplication(sys.argv)
> mw = MainWindow()
> mw.show()
> app.exec_()

How do you trigger the segfault?

What if you fix the obvious bug in dbclick()?

Phil




More information about the PyQt mailing list