From 4cb58c203242e6e24d1628673b145a038c93531f Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 28 May 2009 17:27:44 -0300 Subject: 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 --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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, -- cgit v0.12