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

2006-11-11 Thread Phil Thompson
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

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-11-09 Thread Pavol Mravec

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

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde