[PyKDE] Segfault in QGraphicsScene.drawItems

Phil Thompson phil at riverbankcomputing.co.uk
Fri Feb 23 19:25:20 GMT 2007


On Friday 23 February 2007 7:04 pm, Arve Knudsen wrote:
> 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).

It's a bug - I need to add some handwritten code to handle the array.

Phil




More information about the PyQt mailing list