[PyKDE] bug in pyqt4/python in QTextEdit/QTextBlockUserData

Phil Thompson phil at riverbankcomputing.co.uk
Sat Nov 11 09:59:41 GMT 2006


On Thursday 09 November 2006 8:36 am, Pavol Mravec wrote:
> The following example will cause python to segfault in linux and
> window. tested on latest debian sid pyqt packages and latest windows
> binary distribution of pyqt on winxp. Just run it and when you close
> the window, python itself segfaults.
>
> I would expect at least some sort of exception raised but i think the
> program below is correct and should work normal without any
> segfaulting or raising exceptions.
>
> from PyQt4.QtGui import *
>
> class UserData(QTextBlockUserData):
>     def __init__(self):
>         QTextBlockUserData.__init__(self)
>
> class MainWindow(QMainWindow):
>     def __init__(self, *args):
>         QMainWindow.__init__(self, *args)
>
>         self.te=QTextEdit()
>         self.setCentralWidget(self.te)
>         self.ud=UserData()
>         self.te.textCursor().block().setUserData(self.ud)
>
> app=QApplication(sys.argv)
> mw=MainWindow()
> mw.show()
> app.exec_()

It's an object ownership bug and will be fixed in tonight's snapshot.

Phil




More information about the PyQt mailing list