[PyQt] Segmentation Fault
Fred
pyqt at dezwietjes.nl
Thu Nov 29 11:03:19 GMT 2007
Hi all,
I've got a difficult to track problem. I'm creating a game to learn PyQt and
I'm sure I am missing something really, really obvious, but still: can't find
it.
I made a grid of tiles. Every tile is a graphicsItem on a scene. I've made a
dictionary of tiles where the key is the coordinates on the grid (x,y) and
the content is (a reference to) the qgraphicsItem.
On a certain point in the game, during a mousepressevent, I need to remove a
certain amount of tiles. In a for loop I remove the qgraphicsitem from the
scene and from the dictionary and I delete the item itself (del item).
Then, when it enters the eventloop again, it segfaults. I'm sure it has
something to do with the way I delete the item's. When I delete it from the
scene, but keep it in the dictionary, it works (well, it doesn't segfault).
If I remove it from the dictionary, but not from the scene, it works too. My
guess is that it works in those to cases, because the item itself is then not
deleted. But I want it deleted. Somehow, when I get back into the eventloop,
the removed items are still expected to be there.
Any hints?
More information about the PyQt
mailing list