[PyKDE] Confused about garbage collection and segfaults.

John J. Lee phrxy at csv.warwick.ac.uk
Mon Jun 25 01:29:50 BST 2001


I'm confused about which segmentation faults are to be expected, and which
would be regarded as bugs.  For example, while working through the Qt
tutorial, I missed off a 'return' in CannonField by mistake:

class CannonField(QWidget):
...
    def sizePolicy(self):
       QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

and got a segfault.  Is this something you have to live with, or is it a
bug?  If the former, why does it happen?

I don't really understand this, either:

On Wed, 04 Oct 2000 09:31:20 -0700, Phil Thompson wrote:
> Philippe Fremy wrote:
[...]
> > I use the constructor
> > QCanvasSprite( QCanvasPixmapArray * array, QCanvas * canvas).
> >
> > What qt does with the QCanvasPixampArray is only storing the pointer.
> > This is ok in C++ but not in Python, because the array gets deleted at
> > the end of my assigning function.  When I want to show the
> > QCanvasSprite, I get a segfault.
>
> This is a common issue and is covered in the PyQt docs.

It is, although I couldn't find any specific mention of segfaults.
Perhaps it's worth mentioning, as you generally aren't expecting any
segfaults when writing in Python.



More information about the PyQt mailing list