diff options
author | Tobias Markmann <tm@ayena.de> | 2015-02-08 15:40:50 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-02-09 15:36:19 (GMT) |
commit | 1c64e31945e80e927f87a0a94ec5ce0e00c40a7f (patch) | |
tree | 80f00a3d133ec27945445728ec312c5900c0f975 /Swift/QtUI/QtVCardWidget | |
parent | ef319397be8439482fdf95f46a29643d15980b37 (diff) | |
download | swift-1c64e31945e80e927f87a0a94ec5ce0e00c40a7f.zip swift-1c64e31945e80e927f87a0a94ec5ce0e00c40a7f.tar.bz2 |
Fix memory leaks reported by LSAN
Qt models are not owned by their widgets. They must be deleted manually
or a parent has to be specified for them which will take care of deletion.
The same goes for delegates and their views.
Test-Information:
Tested with Clang's leak sanitizer (part of address sanitizer). The
leak reports for the respective lines are gone with this fix.
Change-Id: Ia7407cb20ae9e4ccc2e1cf48c88877c2f87352e1
Diffstat (limited to 'Swift/QtUI/QtVCardWidget')
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp b/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp index bade009..33863b2 100644 --- a/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp +++ b/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include "QtTagComboBox.h" #include <QAbstractItemView> @@ -13,11 +19,11 @@ namespace Swift { QtTagComboBox::QtTagComboBox(QWidget* parent) : QComboBox(parent) { setEditable(false); - displayModel = new QStandardItemModel(); + displayModel = new QStandardItemModel(this); displayItem = new QStandardItem(); displayItem->setText(""); displayModel->insertRow(0, displayItem); - editMenu = new QMenu(); + editMenu = new QMenu(this); this->setModel(displayModel); editable = true; } |