diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-12-01 07:24:30 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-12-01 07:24:30 (GMT) |
commit | ff7df47d6b3a873f37cf8bcdf46e5daa5168a6fc (patch) | |
tree | 1050b4d6b2d7b1bcdf6da598376b737102eeb0c4 /tools/designer/src | |
parent | 3f4bfebbf2bd9b1e704acaba2f50194b5e42e432 (diff) | |
download | Qt-ff7df47d6b3a873f37cf8bcdf46e5daa5168a6fc.zip Qt-ff7df47d6b3a873f37cf8bcdf46e5daa5168a6fc.tar.gz Qt-ff7df47d6b3a873f37cf8bcdf46e5daa5168a6fc.tar.bz2 |
Designer: Fix coverity warning (memory leak in widget database).
Reviewed-by: Juuso Pakarinen <juuso.pakarinen@tieto.com>
Task-number: QT-4341
Diffstat (limited to 'tools/designer/src')
-rw-r--r-- | tools/designer/src/lib/shared/widgetdatabase.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/designer/src/lib/shared/widgetdatabase.cpp b/tools/designer/src/lib/shared/widgetdatabase.cpp index 0c3e949..7ab450d 100644 --- a/tools/designer/src/lib/shared/widgetdatabase.cpp +++ b/tools/designer/src/lib/shared/widgetdatabase.cpp @@ -54,7 +54,8 @@ #include <QtDesigner/QDesignerFormEditorInterface> #include <QtXml/QXmlStreamWriter> -#include <QtCore/QtAlgorithms> + +#include <QtCore/QScopedPointer> #include <QtCore/qdebug.h> #include <QtCore/QMetaProperty> #include <QtCore/QTextStream> @@ -565,10 +566,10 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget); if (!found) return QString(); - DomUI *domUI = QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false); - domUI->setAttributeVersion(QLatin1String("4.0")); - if (!domUI) + QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false)); + if (domUI.isNull()) return QString(); + domUI->setAttributeVersion(QLatin1String("4.0")); DomWidget *domWidget = domUI->elementWidget(); if (!domWidget) return QString(); @@ -615,7 +616,6 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const domUI->write(writer); writer.writeEndDocument(); } - delete domUI; return rc; } |