diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2009-12-07 14:04:42 (GMT) |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2009-12-07 14:04:42 (GMT) |
commit | fb78a402b512b017c850e7410745c4d20da04a7c (patch) | |
tree | 0b3a4ec5f08bebf566a3e46e55c228ab9fbcbd9b /tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | |
parent | 7ad244cad155f32f22e82e1458eb1c42f759a620 (diff) | |
download | Qt-fb78a402b512b017c850e7410745c4d20da04a7c.zip Qt-fb78a402b512b017c850e7410745c4d20da04a7c.tar.gz Qt-fb78a402b512b017c850e7410745c4d20da04a7c.tar.bz2 |
Fixed memory leaks when removing a QGraphicsEffect from a QGraphicsItem or QWidget
with setGraphicsEffect(0).
The effect was not deleted in that case, problem solved for both QGraphicsItem
and QWidget.
Autotest included.
Task-number: QTBUG-5917
Reviewed-by: bnilsen
Diffstat (limited to 'tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 565a3e7..6266933 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7962,6 +7962,22 @@ void tst_QGraphicsItem::setGraphicsEffect() delete item; QVERIFY(!blurEffect); delete anotherItem; + + // Ensure the effect is uninstalled when deleting it + item = new QGraphicsRectItem(0, 0, 10, 10); + blurEffect = new QGraphicsBlurEffect; + item->setGraphicsEffect(blurEffect); + delete blurEffect; + QVERIFY(!item->graphicsEffect()); + + // Ensure the existing effect is uninstalled and deleted when setting a null effect + blurEffect = new QGraphicsBlurEffect; + item->setGraphicsEffect(blurEffect); + item->setGraphicsEffect(0); + QVERIFY(!item->graphicsEffect()); + QVERIFY(!blurEffect); + + delete item; } void tst_QGraphicsItem::panel() |