diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 10:12:01 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 10:33:11 (GMT) |
commit | 43e4e8969942e58ca0ecb3b8ad23ebe32ac4aa44 (patch) | |
tree | cc534af4ca210f11342f887b93686903b5544251 /tests/auto | |
parent | c0b81480b2909b18ac15bdd124a562ae005c2f41 (diff) | |
download | Qt-43e4e8969942e58ca0ecb3b8ad23ebe32ac4aa44.zip Qt-43e4e8969942e58ca0ecb3b8ad23ebe32ac4aa44.tar.gz Qt-43e4e8969942e58ca0ecb3b8ad23ebe32ac4aa44.tar.bz2 |
Fix crash when QGraphicsItem destructor deletes other QGraphicsItem
Same fix as e7a10b00be3e4aa197900ecf424e6d44b07248ae
Reviewed-by: Alexis
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 38abc3d..32206db 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()); |