[PyKDE] weird PyQt bug: memory corruption?

Phil Thompson phil at riverbankcomputing.co.uk
Sun Apr 24 14:56:03 BST 2005


On Thursday 21 April 2005 7:09 pm, Giovanni Bajo wrote:
> 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).

I see the same behaviour using the same versions. However with current 
snapshots the behaviour is as expected.

Phil




More information about the PyQt mailing list