summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-07-13 13:18:19 (GMT)
committerTobias Markmann <tm@ayena.de>2015-07-14 08:14:37 (GMT)
commit0cfa934c4c0323cc9e8e1431f25a05977e3670a6 (patch)
tree5c10d9147e5931a16bfc771cff7b6797d9b58c54 /Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
parentcb8a1c43ff96c1d82c8ba1d30e210135303bbe26 (diff)
downloadswift-0cfa934c4c0323cc9e8e1431f25a05977e3670a6.zip
swift-0cfa934c4c0323cc9e8e1431f25a05977e3670a6.tar.bz2
Fix memory leak in QtUserSearchWindow
The delegate was not correctly freed and was leaking across login/logout sessions. Setting the parent of the delegate during initialization, so it will be freed by Qt when the QtUserSearchWindow is freed. Delegated the deallocation to Qt, because it has to be freed after the widget that uses the delegate is freed. Test-Information: The leak was reported by Valgrind. Verified with Valgrind that this commit fixes the leak and is not reported anymore. Change-Id: Ib48d2628577433bce82103b3f14cbd11d733b7ac
Diffstat (limited to 'Swift/QtUI/UserSearch/QtUserSearchWindow.cpp')
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index cff34d8..737196a 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -1,36 +1,38 @@
/*
- * 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/UserSearch/QtUserSearchWindow.h"
+#include <Swift/QtUI/UserSearch/QtUserSearchWindow.h>
+
+#include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <QItemDelegate>
#include <QModelIndex>
-#include <QWizardPage>
#include <QMovie>
-#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <QWizardPage>
+#include <Swiften/Base/Log.h>
#include <Swiften/Base/foreach.h>
-#include <Swift/Controllers/UIEvents/UIEventStream.h>
-#include <Swift/Controllers/UIEvents/RequestChatUIEvent.h>
+
#include <Swift/Controllers/UIEvents/AddContactUIEvent.h>
#include <Swift/Controllers/UIEvents/CreateImpromptuMUCUIEvent.h>
#include <Swift/Controllers/UIEvents/InviteToMUCUIEvent.h>
-#include <Swift/QtUI/UserSearch/UserSearchModel.h>
-#include <Swift/QtUI/UserSearch/UserSearchDelegate.h>
-#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swift/Controllers/UIEvents/RequestChatUIEvent.h>
+#include <Swift/Controllers/UIEvents/UIEventStream.h>
+
#include <Swift/QtUI/QtFormResultItemModel.h>
-#include <Swift/QtUI/UserSearch/QtUserSearchFirstPage.h>
-#include <Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.h>
+#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swift/QtUI/UserSearch/QtContactListWidget.h>
+#include <Swift/QtUI/UserSearch/QtUserSearchDetailsPage.h>
#include <Swift/QtUI/UserSearch/QtUserSearchFieldsPage.h>
+#include <Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.h>
+#include <Swift/QtUI/UserSearch/QtUserSearchFirstPage.h>
#include <Swift/QtUI/UserSearch/QtUserSearchResultsPage.h>
-#include <Swift/QtUI/UserSearch/QtUserSearchDetailsPage.h>
-#include <Swift/QtUI/UserSearch/QtContactListWidget.h>
-
-#include <Swiften/Base/Log.h>
+#include <Swift/QtUI/UserSearch/UserSearchDelegate.h>
+#include <Swift/QtUI/UserSearch/UserSearchModel.h>
namespace Swift {
@@ -53,7 +55,7 @@ QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWin
}
setWindowTitle(title);
- delegate_ = new UserSearchDelegate();
+ delegate_ = new UserSearchDelegate(this);
setFirstPage(title);
setSecondPage();