Do not leak memory
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Wed, 7 Sep 2011 07:48:50 +0000 (09:48 +0200)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>
Wed, 7 Sep 2011 09:33:42 +0000 (11:33 +0200)
Task-number: QT-4333

Change-Id: Idadb3eec3ac1b8775017ead6deff38e22d5b04b2
Reviewed-on: http://codereview.qt.nokia.com/4323
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp

index ff4bf84..c9bda58 100644 (file)
@@ -2966,11 +2966,12 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
             AnchorData *ad = variables.at(i);
             ad->sizeAtPreferred = ad->result - g_offset;
         }
-
-        // Make sure we delete the simplex solver -before- we delete the
-        // constraints used by it.
-        delete simplex;
     }
+
+    // Make sure we delete the simplex solver -before- we delete the
+    // constraints used by it.
+    delete simplex;
+
     // Delete constraints and variables we created.
     qDeleteAll(preferredConstraints);
     qDeleteAll(preferredVariables);