[PyQt] Help tracking down intermittent segfault using QGraphicsItem

Mathias.Born at gmx.de Mathias.Born at gmx.de
Sat Jan 5 18:12:34 GMT 2013


On 05.01.2013, 16:50:29 Andreas Pakulat wrote:
[...]
> Often a segfault is caused by using a pointer (in C++) which points to
> a memory location thats not valid anymore, for example because the
> object has been deleted already. In the context of PyQt this can
> happen when you stop keeping references to objects that or instances
> of C++-provided classes in python. In such a case the C++ parts of the
> object will be deleted and thus any other C++ code that has a
> reference to the object will crash when it tries to access the object.
> I think thats the most common problem one encounters with PyQt4.

While this is certainly true in general, I'd say that sip goes to
great length in order to avoid that kind of crash by carefully
observing who owns what. It is aware of the parent-child memory
management of Qt. A python program should never be able to cause a
crash. Is there any place in PyQt where the Python code has to keep
references to keep the program going?

Best Regards,
Mathias Born




More information about the PyQt mailing list