From c1015dde1545f17a8aaee98b7c0e0217f8df620c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 12 Mar 2024 13:10:39 +0100 Subject: [PATCH] DeviceSettingsWidget: Don't leak QActions Amends 662aabd29f8e847abed41cce5f4bb5747502ed9d Change-Id: I353a93b3b3752d639f9fc5d45467c843bed6a604 Reviewed-by: Marcus Tillmanns --- .../projectexplorer/devicesupport/devicesettingspage.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp index a7405ef46e2..dfcfc83a1be 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp @@ -77,7 +77,7 @@ private: DeviceManager * const m_deviceManager; DeviceManagerModel * const m_deviceManagerModel; QList m_additionalActionButtons; - IDeviceWidget *m_configWidget; + IDeviceWidget *m_configWidget = nullptr; QLabel *m_configurationLabel; QComboBox *m_configurationComboBox; @@ -97,7 +97,6 @@ private: DeviceSettingsWidget::DeviceSettingsWidget() : m_deviceManager(DeviceManager::cloneInstance()) , m_deviceManagerModel(new DeviceManagerModel(m_deviceManager, this)) - , m_configWidget(nullptr) { m_configurationLabel = new QLabel(Tr::tr("&Device:")); m_configurationComboBox = new QComboBox; @@ -116,7 +115,7 @@ DeviceSettingsWidget::DeviceSettingsWidget() connect(addButton, &OptionPushButton::clicked, this, &DeviceSettingsWidget::addDevice); QMenu *deviceTypeMenu = new QMenu(addButton); - QAction *defaultAction = new QAction(Tr::tr("&Start Wizard to Add Device...")); + QAction *defaultAction = new QAction(Tr::tr("&Start Wizard to Add Device..."), this); connect(defaultAction, &QAction::triggered, this, &DeviceSettingsWidget::addDevice); deviceTypeMenu->addAction(defaultAction); deviceTypeMenu->addSeparator(); @@ -128,7 +127,7 @@ DeviceSettingsWidget::DeviceSettingsWidget() continue; //: Add - QAction *action = new QAction(Tr::tr("Add %1").arg(factory->displayName())); + QAction *action = new QAction(Tr::tr("Add %1").arg(factory->displayName()), this); deviceTypeMenu->addAction(action); connect(action, &QAction::triggered, this, [factory, this] {