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

Pavol Mravec palo at ksp.sk
Thu Nov 9 08:36:47 GMT 2006


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




More information about the PyQt mailing list