From ac83e69ffbabff8a5e674d38f0bc90ff5f188f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 4 Dec 2009 11:24:27 +0100 Subject: Made sure that we didn't reference dangling parallel anchors. We cannot delete the parallel anchors before we do the actual vertex restoration, since the parallel anchors created by vertex simplification will always be connected to some of the AnchorVertexPair found in simplifiedVertices that we iterate over later. Thus, we must delete the parallel anchors created by vertex simplification after we have done the restoration of the vertices. (the parallel anchor will be properly dealt with (i.e. taken out of the graph as we do the restoration)), so not deleting it won't cause it to be revisited later if that is a worry. Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index b33e228..03ed63d 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1317,9 +1317,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) for (int i = parallelAnchors.count() - 1; i >= 0; --i) { ParallelAnchorData *parallel = static_cast(parallelAnchors.at(i)); restoreSimplifiedConstraints(parallel); - delete parallel; } - parallelAnchors.clear(); // Then, we will restore the vertices in the inverse order of creation, this way we ensure that // the vertex being restored was not wrapped by another simplification. @@ -1365,6 +1363,8 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) delete pair; } + qDeleteAll(parallelAnchors); + parallelAnchors.clear(); toRestore.clear(); } -- cgit v0.12