Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.8.1
-
None
-
Windows 7-64, Qt for Desktop 4.8.1
Description
Application crash by calling QGraphicsScene::clear() method and re adding existing item:
MyClass::MyClass() { scene = new QGraphicsScene(...); item = new MyGraphicsItem(); scene->addItem(item); } ... void MyClass::f() { scene->clear(); scene->addItem(item); }
by adding QGraphicsScene::removeItem(item) before ::clear() seems to solve issue:
void MyClass::f() { scene->removeItem(item); scene->clear(); scene->addItem(item); }
Same behavior by trying to add existing item two times.
Also, suggestion to add method that checks for item existence in QGraphicsScene.