[Interest] QGraphicsScene crashed after removeItem() and delete item
程梁
devbean at outlook.com
Sun Sep 22 17:56:54 CEST 2013
Hi, there! I have a problem: when I called QGraphicsScene::removeItem() then delete the removed item, my application crashed. This happens on Qt5 64bits (I tested on openSUSE with 5.1.1 and gcc 4.7.2) but not on Qt4.
This is my code:
void GameController::snakeAteFood(Snake *snake, Food *food)
{
scene.removeItem(food);
delete food;
addNewFood();
}
If I remove the line "delete food;" everything is OK. But it will crash with this line. The Food::boundingRect() will not change but Snake::boundingRect() does so I did add prepareGeometryChange() function before it changed. I've no idea why this still crashed. Please help me.
Thank you!
Cheng Liang
Nanjing, China
http://www.devbean.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130922/10a90b7f/attachment.html>
More information about the Interest
mailing list