diff options
author | Andreas Aardal Hanssen <andreas.hanssen@tandberg.com> | 2010-07-14 10:02:08 (GMT) |
---|---|---|
committer | Toby Tomkins <toby.tomkins@nokia.com> | 2010-07-16 00:34:43 (GMT) |
commit | aea1b6326d598b07a283a02863864850ac76d283 (patch) | |
tree | 32000ef2936b28f237db5f4bec23d5ddca206192 /tests/auto | |
parent | 29b2afa8d6689b96c185a779fa8353c1018dc0a7 (diff) | |
download | Qt-aea1b6326d598b07a283a02863864850ac76d283.zip Qt-aea1b6326d598b07a283a02863864850ac76d283.tar.gz Qt-aea1b6326d598b07a283a02863864850ac76d283.tar.bz2 |
Work around memory leak issue in grid and linear layouts.
These classes create a new QWidget and assign it to a static pointer
which is never cleaned up. Using Q_GLOBAL_STATIC ensures that they are
deleted on library unload. This is really just a cosmetic change that
removes a leak warning - the real fix should be to find a way to not
use a new QWidget like this. It seems odd that QGraphicsLayouts, which
don't use QWidget in any other way, should depend on QWidget like this.
Task-number: QTBUG-10768
Merge-request: 741
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
(cherry picked from commit ea6a5146397b668bf535ee7249bd4262d6185234)
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index b9a5c66..d1d6860 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -105,6 +105,7 @@ private slots: void geometries_data(); void geometries(); void avoidRecursionInInsertItem(); + void styleInfoLeak(); void task236367_maxSizeHint(); }; @@ -2196,6 +2197,12 @@ void tst_QGraphicsGridLayout::avoidRecursionInInsertItem() QCOMPARE(layout->count(), 0); } +void tst_QGraphicsGridLayout::styleInfoLeak() +{ + QGraphicsGridLayout grid; + grid.horizontalSpacing(); +} + void tst_QGraphicsGridLayout::task236367_maxSizeHint() { QGraphicsWidget *widget = new QGraphicsWidget; diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index c26e5d4..6107fa1 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -102,6 +102,7 @@ private slots: void layoutDirection(); void removeLayout(); void avoidRecursionInInsertItem(); + void styleInfoLeak(); // Task specific tests void task218400_insertStretchCrash(); @@ -1443,6 +1444,12 @@ void tst_QGraphicsLinearLayout::avoidRecursionInInsertItem() QCOMPARE(layout->count(), 0); } +void tst_QGraphicsLinearLayout::styleInfoLeak() +{ + QGraphicsLinearLayout layout; + layout.spacing(); +} + void tst_QGraphicsLinearLayout::task218400_insertStretchCrash() { QGraphicsScene *scene = new QGraphicsScene; |