diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-05-28 20:27:44 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-07-22 18:04:09 (GMT) |
commit | 4cb58c203242e6e24d1628673b145a038c93531f (patch) | |
tree | 356ef151ce3dd6b61013c9afb6723a7adb86ac89 | |
parent | 12913735db966558ac255780aaee0ec0d1096a8c (diff) | |
download | Qt-4cb58c203242e6e24d1628673b145a038c93531f.zip Qt-4cb58c203242e6e24d1628673b145a038c93531f.tar.gz Qt-4cb58c203242e6e24d1628673b145a038c93531f.tar.bz2 |
QGraphicsAnchorLayout: Temporary destructor to avoid memory leaks
Currently the itemCenterConstraints that are created when an item
is added to the layout are never being deleted.
Ideally this should be done by the time the item is removed from
the layout, this requires some changes in the data structures used
though. As a temporary solution we keep all of them until the
layout is destroyed.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index b3dcdd0..260c823 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -62,6 +62,18 @@ QGraphicsAnchorLayout::~QGraphicsAnchorLayout() } d->deleteLayoutEdges(); + + // ### make something better here + qDeleteAll(d->itemCenterConstraints[0]); + d->itemCenterConstraints[0].clear(); + qDeleteAll(d->itemCenterConstraints[1]); + d->itemCenterConstraints[1].clear(); + + Q_ASSERT(d->items.isEmpty()); + Q_ASSERT(d->m_vertexList.isEmpty()); + + // ### Remove when integrated into Qt + delete d_ptr; } void QGraphicsAnchorLayout::anchor(QGraphicsLayoutItem *firstItem, |