[PyKDE] Segfault in QGraphicsScene.drawItems

Arve Knudsen arve.knudsen at gmail.com
Fri Feb 23 19:04:36 GMT 2007


On 2/23/07, Michael Guntsche <mike at it-loops.com> wrote:
>
>
> On Feb 23, 2007, at 17:51, Arve Knudsen wrote:
>
> > Hello
> > If I try to reimplement the method drawItems in a QGraphicsScene
> > subclass, the program segfaults. Is this a bug in PyQt? I am by the
> > way using PyQt 4.1.1 (self-compiled) and Qt 4.2.0 (Ubuntu). I've
> > included a sample program which exhibits the behaviour.
> >
>
> Works here.
> QT 4.2.2 and the latest Pyqt snapshot.


Very strange ... I've now installed the latest snapshot, and the problem
persists. This time on a Gentoo installation with Qt 4.2.2. Inspecting the
generated Python bindings, sipQtGuiQGraphicsScene.cpp, it seems to me there
is a bug in meth_QGraphicsScene_drawItems. Argument 3, an array of
QGraphicsItem*, is actually treated as a return value from the corresponding
C++ function and thus uninitialized before being passed to Qt. As such I
wonder how come it doesn't crash on your machine, maybe the memory error is
not detected?

If you print out the arguments to drawItems in Python you'll find that
instead of a list of QGraphicItems you'll receive an int instead (the number
of items).

Arve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070223/4537d2c3/attachment.html


More information about the PyQt mailing list