[PyKDE] canvas related segfault

Hans-Peter Jansen hpj at urpla.net
Thu Feb 10 17:16:58 GMT 2005


On Thursday 10 February 2005 17:22, Phil Thompson wrote:
> >
> > Hmm, none of these lines below app.exec_loop() seems to be needed
> > here as everthing is destructed just fine without them. So maybe
> > this comment is misleading or outdated.
>
> From memory it's because QCanvas accesses any images in it's
> destructor. If they have already been destroyed then there is a
> segfault. In canvas.py the images and the QCanvas are referenced in
> the module dictionary and the order in which they are garbage
> collected is non-deterministic. Those extra lines ensure the
> QCanvas is destroyed before the images.

Hmm, I think, a better strategy would be to call the clear() method on 
close and getting rid of all those globals. IMHO, such examples 
shouldn't teach bad style! I will look into it again...

> BTW, QObject.inherits() and QObject.isA() will be fixed in the next
> PyQt snapshot.

Cool. Thanks.

Cheers,
Pete




More information about the PyQt mailing list