[PyQt] Help tracking down intermittent segfault using QGraphicsItem
Lee Harr
missive at hotmail.com
Sat Jan 5 04:11:10 GMT 2013
I develop a free python turtle graphics application:
http://pynguin.googlecode.com/
Right now I am trying to track down and fix an intermittent
segfault involving a QGraphicsScene and QGraphicsItem
Here is what I have...
a QGraphicsItem subclass (item0) created with parent=None
another QGraphicsItem subclass (item1) created with parent=item0
I then add item0 to my scene and things appear to be
working fine, but when removing and adding instances
of this arrangement in rapid succession I will soon get
a segfault.
If you want to play along at home, load the "horserace.pyn"
example and run the "tournament" function. For me it will
crash reliably within the first 2 or 3 races.
In this case, item1 represents the text labels for the horses.
If I remove the labels, I never see the segfault.
The strangest part is that if I manually add item1 to the scene
(should not be needed since the child is automatically added when
the parent is added) I do not get the segfault.
The only problem with this is that I get a warning:
"QGraphicsScene::addItem: item has already been added to this scene"
So... my questions:
What is most likely to be the real problem here?
How likely is it that if I get it to the point that there is no segfault
on my machine (ie, just leave in the code that generates the warning)
that it won't segfault on a different OS/architecture?
What is the best way to go about tracking down and fixing the real problem?
Thanks for any assistance.
More information about the PyQt
mailing list