No subject

Thu Mar 8 10:26:06 GMT 2007

> 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-

Any help appreciated


More information about the PyQt mailing list