summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsscene
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-04 11:12:01 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-04 11:33:11 +0100
commit43e4e8969942e58ca0ecb3b8ad23ebe32ac4aa44 (patch)
treecc534af4ca210f11342f887b93686903b5544251 /tests/auto/qgraphicsscene
parentc0b81480b2909b18ac15bdd124a562ae005c2f41 (diff)
Fix crash when QGraphicsItem destructor deletes other QGraphicsItem
Same fix as e7a10b00be3e4aa197900ecf424e6d44b07248ae Reviewed-by: Alexis
Diffstat (limited to 'tests/auto/qgraphicsscene')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 38abc3d670..32206db8f0 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1462,6 +1462,7 @@ void tst_QGraphicsScene::focusItemLostFocus()
class ClearTestItem : public QGraphicsRectItem
{
public:
+ ClearTestItem(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {}
~ClearTestItem() { qDeleteAll(items); }
QList<QGraphicsItem *> items;
};
@@ -1486,6 +1487,11 @@ void tst_QGraphicsScene::clear()
scene.addItem(secondItem);
QCOMPARE(scene.items().at(0), firstItem);
QCOMPARE(scene.items().at(1), secondItem);
+
+ ClearTestItem *thirdItem = new ClearTestItem(firstItem);
+ QGraphicsItem *forthItem = new QGraphicsRectItem(firstItem);
+ thirdItem->items += forthItem;
+
// must not crash even if firstItem deletes secondItem
scene.clear();
QVERIFY(scene.items().isEmpty());