diff options
author | Tobias Hunger <tobias.hunger@digia.com> | 2014-08-22 13:31:02 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@digia.com> | 2014-09-04 13:44:48 +0200 |
commit | 627657217e9c74ca0ed622cb5df122f555fa8070 (patch) | |
tree | 70993902f2b48aa6765e55c80f3764d0377e20c3 /src/tools/uic/cpp | |
parent | ec5f402cfd0bc439cd373ca8c99c59cb11556966 (diff) |
Uic: Fix memory leaks
Fix some memory leaks in uic. These break the Qt build with clangs
address sanitizer feature enabled as Clang will cause uic to fail when
it detects these leaks. This in turn will stop the Qt build.
Change-Id: I6794b29f5a36fc8a2d59cf36f6d7459f3f50d56d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/tools/uic/cpp')
-rw-r--r-- | src/tools/uic/cpp/cppwriteinitialization.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 9b1903b136..3c0d98f33c 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -921,6 +921,7 @@ void WriteInitialization::acceptLayout(DomLayout *node) m_layoutMarginType = SubLayoutMargin; DomPropertyList propList = node->elementProperty(); + DomPropertyList newPropList; if (m_layoutWidget) { bool left, top, right, bottom; left = top = right = bottom = false; @@ -940,31 +941,38 @@ void WriteInitialization::acceptLayout(DomLayout *node) DomProperty *p = new DomProperty(); p->setAttributeName(QLatin1String("leftMargin")); p->setElementNumber(0); - propList.append(p); + newPropList.append(p); } if (!top) { DomProperty *p = new DomProperty(); p->setAttributeName(QLatin1String("topMargin")); p->setElementNumber(0); - propList.append(p); + newPropList.append(p); } if (!right) { DomProperty *p = new DomProperty(); p->setAttributeName(QLatin1String("rightMargin")); p->setElementNumber(0); - propList.append(p); + newPropList.append(p); } if (!bottom) { DomProperty *p = new DomProperty(); p->setAttributeName(QLatin1String("bottomMargin")); p->setElementNumber(0); - propList.append(p); + newPropList.append(p); } m_layoutWidget = false; } + propList.append(newPropList); + writeProperties(varName, className, propList, WritePropertyIgnoreMargin|WritePropertyIgnoreSpacing); + // Clean up again: + propList.clear(); + qDeleteAll(newPropList); + newPropList.clear(); + m_layoutChain.push(node); TreeWalker::acceptLayout(node); m_layoutChain.pop(); |