[PyKDE] weird PyQt bug: memory corruption?
Giovanni Bajo
rasky at develer.com
Thu Apr 21 19:09:34 BST 2005
Hello,
I have found a very weird bug with PyQt, which might be some sort of memory
corruption thus hard to reproduce. I'm using Qt 3.3.4, PyQt 3.14.1, SIP
4.2.1, under Windows.
This is the minimal snippet (took me two hours to reduce it...):
------------------------------------------------------
from qt import *
class W1(QWidget):
def __init__(self):
QWidget.__init__(self, None)
QComboBox(self)
self.queryList("")
self.sizeHint()
app = QApplication([])
W1()
print QScrollView(None).viewport().className()
print QScrollView(None).viewport().className()
print QScrollView(None).viewport().className()
print QScrollView(None).viewport().className()
print QScrollView(None).viewport().className()
print QScrollView(None).viewport().className()
------------------------------------------------------
which prints:
------------------------------------------------------
QWidget
QObject
QWidget
QObject
QWidget
QObject
QWidget
QObject
------------------------------------------------------
which is of course totally weird.
Notice the weird things you have to do in that widget constructor to
reproduce this. Commenting every line in the above testcase causes the bug
to disappear. It is also very sensitive to order of operations.
Can anybody reproduce this? Phil, do you have any idea about what might be
causing this?
What happens in my full application is an AttributeError while trying to
call QScrollView.viewport().setBackgroundMode, because the name does not
exit (the object is a QObject instead of a QWidget).
--
Giovanni Bajo
More information about the PyQt
mailing list