Commit 4cef9b9c authored by David Hallas's avatar David Hallas Committed by Kurt Hindenburg

Fixes minor memory leaks

Summary:
Fixes a few minor memory leaks found with address sanitizer.
The newTabButton and closeTabButton was not passed a parent and is not
deleted in the destructor of TabbedViewContainer which will cause them
to be leaked when closing a tab. Instead pass the TabbedViewContainer as
the parent.
The same goes for the profileMenu, it was not passed a parent pointer at
contruction and the setMenu function doesn't take ownership of it, so
therefore it was also leaked.

Backported the original version

https://phabricator.kde.org/D19634
parent d67c23f7
......@@ -56,8 +56,8 @@ using namespace Konsole;
TabbedViewContainer::TabbedViewContainer(ViewManager *connectedViewManager, QWidget *parent) :
QTabWidget(parent),
_connectedViewManager(connectedViewManager),
_newTabButton(new QToolButton()),
_closeTabButton(new QToolButton()),
_newTabButton(new QToolButton(this)),
_closeTabButton(new QToolButton(this)),
_contextMenuTabIndex(-1),
_navigationVisibility(ViewManager::NavigationVisibility::NavigationNotSet),
_tabHistoryIndex(-1)
......@@ -132,7 +132,7 @@ TabbedViewContainer::TabbedViewContainer(ViewManager *connectedViewManager, QWid
);
closeAction->setObjectName(QStringLiteral("tab-close"));
auto profileMenu = new QMenu();
auto profileMenu = new QMenu(this);
auto profileList = new ProfileList(false, profileMenu);
profileList->syncWidgetActions(profileMenu, true);
connect(profileList, &Konsole::ProfileList::profileSelected, this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment