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.
>From the PyQt docs:
> Sometimes a Qt class instance will maintain a pointer to another
> instance and will eventually call the destructor of that second
> instance. The most common example is that a QObject (and any of its
> sub-classes) keeps pointers to its children and will automatically call
> their destructors. In these cases, the corresponding Python object will
> also keep a reference to the corresponding child objects.
Maybe add something like "If you create a (subclass of) QObject in your
Python code that refers to an object whose corresponding C++ object will
remain in existence after the Python object is garbage-collected, this
will cause a segmentation fault."? Is that right?? Does the C++ object
have to have a slot (implemented as a Python callable) which gets called
from C++ at some point for a segfault to be caused?
Actually, why do you get a segfault at all in the example above? If the
Python instance of Python class QCanvasSprite has a reference to the
QCanvasPixmapArray, why would the QCanvasPixmapArray get garbage-
collected?
Any help appreciated
John
_______________________________________________
PyKDE mailing list [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde