[PyKDE] How do I delete a QCanvasItem?

Boudewijn Rempt boud at valdyas.org
Wed Jun 12 22:11:00 BST 2002


On Wednesday 12 June 2002 18:32, Stephen Green wrote:
> From: Moray Taylor <mtaylor at lowebroadway.com>
>
> >I think I have figured out how to do it.
> >
> >MyCanvasItem.setCanvas(None)
> >
> >It gets rid of it, and seems to free any memory it was using.
> >
> >Any comments?
> >
> >Moray
>
> I tried doing that, and it seems to make the canvas item disappear, but
> shortly thereafter I always get a segmentation fault.  I can't figure out
> why this is happening, since I'm pretty sure I've removed all references to
> the canvas item.
> Any ideas?
>

If I simply add 

	item.setCanvas(None)

after item.show() in the test script I posted earlier, I don't get a 
segfault. It's quite possible that my script is too simple, and that the
segfault occurs only under more complex circumstances. Could you run the
attached file, and see if it segfaults for you?

-- 
Boudewijn Rempt | http://www.valdyas.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: canvas.py
Type: text/x-python
Size: 852 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020612/671f01af/canvas.py


More information about the PyQt mailing list