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 | |
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
-rw-r--r-- | Swift/Controllers/MainController.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtContactListWidget.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp | 4 | ||||
-rw-r--r-- | Swiften/Client/Client.cpp | 4 | ||||
-rw-r--r-- | Swiften/FileTransfer/FileTransferManagerImpl.cpp | 6 |
7 files changed, 26 insertions, 9 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index d8c32be..328d837 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/Controllers/MainController.h> @@ -120,12 +120,13 @@ MainController::MainController( loginWindow_(NULL) , useDelayForLatency_(useDelayForLatency), ftOverview_(NULL), emoticons_(emoticons) { storages_ = NULL; certificateStorage_ = NULL; + certificateTrustChecker_ = NULL; statusTracker_ = NULL; presenceNotifier_ = NULL; eventNotifier_ = NULL; rosterController_ = NULL; chatsManager_ = NULL; historyController_ = NULL; @@ -267,12 +268,14 @@ void MainController::resetClient() { delete rosterController_; rosterController_ = NULL; delete eventNotifier_; eventNotifier_ = NULL; delete presenceNotifier_; presenceNotifier_ = NULL; + delete certificateTrustChecker_; + certificateTrustChecker_ = NULL; delete certificateStorage_; certificateStorage_ = NULL; delete storages_; storages_ = NULL; delete statusTracker_; statusTracker_ = NULL; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 7b32bff..1d945da 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/QtSwift.h> @@ -262,9 +262,10 @@ QtSwift::~QtSwift() { delete uriHandler_; delete dock_; delete soundPlayer_; delete chatWindowFactory_; delete certificateStorageFactory_; delete storagesFactory_; + delete applicationPathProvider_; } } 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 @@ -1,26 +1,32 @@ /* * Copyright (c) 2012 Tobias Markmann * Licensed under the simplified BSD license. * 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> #include <QtGui> 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; } QtTagComboBox::~QtTagComboBox() { diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.cpp b/Swift/QtUI/UserSearch/QtContactListWidget.cpp index 1069678..9b76aba 100644 --- a/Swift/QtUI/UserSearch/QtContactListWidget.cpp +++ b/Swift/QtUI/UserSearch/QtContactListWidget.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2013 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/UserSearch/QtContactListWidget.h> @@ -56,12 +56,13 @@ QtContactListWidget::QtContactListWidget(QWidget* parent, SettingsProvider* sett #endif } QtContactListWidget::~QtContactListWidget() { delete contactListDelegate_; delete removableItemDelegate_; + delete contactListModel_; } void QtContactListWidget::setList(const std::vector<Contact::ref>& list) { contactListModel_->setList(list); } diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp index 151313c..2b775f9 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2013 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/UserSearch/QtSuggestingJIDInput.h> #include <Swift/QtUI/UserSearch/ContactListDelegate.h> @@ -58,12 +58,14 @@ QtSuggestingJIDInput::QtSuggestingJIDInput(QWidget* parent, SettingsProvider* se settings_->onSettingChanged.connect(boost::bind(&QtSuggestingJIDInput::handleSettingsChanged, this, _1)); } QtSuggestingJIDInput::~QtSuggestingJIDInput() { settings_->onSettingChanged.disconnect(boost::bind(&QtSuggestingJIDInput::handleSettingsChanged, this, _1)); delete treeViewPopup_; + delete contactListDelegate_; + delete contactListModel_; } Contact::ref QtSuggestingJIDInput::getContact() { if (!!currentContact_) { return currentContact_; } diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index 323bb43..d2f8b7a 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2010-2012 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Client/Client.h> @@ -83,12 +83,13 @@ Client::Client(const JID& jid, const SafeString& password, NetworkFactories* net Client::~Client() { delete pubsubManager; delete whiteboardSessionManager; delete fileTransferManager; + delete blockListManager; delete jingleSessionManager; delete blindCertificateTrustChecker; delete nickResolver; delete nickManager; @@ -122,12 +123,13 @@ XMPPRoster* Client::getRoster() const { void Client::setSoftwareVersion(const std::string& name, const std::string& version, const std::string& os) { softwareVersionResponder->setVersion(name, version, os); } void Client::handleConnected() { + delete fileTransferManager; #ifdef SWIFT_EXPERIMENTAL_FT fileTransferManager = new FileTransferManagerImpl( getJID(), jingleSessionManager, getIQRouter(), getEntityCapsProvider(), diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp index fe8bfd6..f439197 100644 --- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp +++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2013-2014 Isode Limited. + * Copyright (c) 2013-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/FileTransferManagerImpl.h> @@ -83,16 +83,18 @@ FileTransferManagerImpl::FileTransferManagerImpl( timerFactory, crypto); incomingFTManager->onIncomingFileTransfer.connect(onIncomingFileTransfer); } FileTransferManagerImpl::~FileTransferManagerImpl() { - delete s5bServerManager; delete incomingFTManager; delete outgoingFTManager; delete transporterFactory; + delete bytestreamProxy; + delete s5bServerManager; + delete bytestreamRegistry; } void FileTransferManagerImpl::start() { } void FileTransferManagerImpl::stop() { |