From 50154c4c5ce1728ed9e1eeab0f1f18bec9f528f8 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 3 Jul 2022 07:55:59 +0300 Subject: [PATCH 33/33] Qt: Fix go_act_menu memory leak See osdn #44983 Signed-off-by: Marko Lindqvist --- client/gui-qt/menu.cpp | 6 +++--- client/gui-qt/menu.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index d89a83f5f3..f3692b6c26 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -692,7 +692,7 @@ void gov_menu::update_all() /**********************************************************************//** Instantiate a new goto and act sub menu. **************************************************************************/ -go_act_menu::go_act_menu(QWidget* parent) +go_act_menu::go_act_menu(QWidget *parent) : QMenu(_("Go to and..."), parent) { /* Will need auto updates etc. */ @@ -1208,8 +1208,8 @@ void mr_menu::setup_menus() menu_list.insert(STANDARD, act); connect(act, &QAction::triggered, this, &mr_menu::slot_unit_goto); - /* The goto and act sub menu is handled as a separate object. */ - menu->addMenu(new go_act_menu()); + // The goto and act sub menu is handled as a separate object. + menu->addMenu(new go_act_menu(this)); act = menu->addAction(_("Go to Nearest City")); act->setShortcut(QKeySequence(tr("shift+g"))); diff --git a/client/gui-qt/menu.h b/client/gui-qt/menu.h index d0a60864d9..48e28c02f1 100644 --- a/client/gui-qt/menu.h +++ b/client/gui-qt/menu.h @@ -237,7 +237,7 @@ class go_act_menu : public QMenu QMap items; public: - go_act_menu(QWidget* parent = 0); + go_act_menu(QWidget *parent = nullptr); virtual ~go_act_menu(); static void reset_all(); -- 2.35.1