diff options
author | Piotr Mućko <piotr.mucko@qt.io> | 2022-03-28 16:42:51 +0200 |
---|---|---|
committer | Piotr Mućko <piotr.mucko@qt.io> | 2022-04-01 13:55:34 +0000 |
commit | a3fbfac814c1a7fe67f8ad64cc71d20a4e8afac7 (patch) | |
tree | e7e76be0246f1e28d5e3df57198ebd0930b02beb /src/plugins/mcusupport/mcupackage.cpp | |
parent | 652f130faef2c1818b8c8025768c589add4a82b3 (diff) | |
download | qt-creator-a3fbfac814c1a7fe67f8ad64cc71d20a4e8afac7.tar.gz |
McuSupport: Automatic memory management for mcu sdk
Fix crash while automatically restoring kits during startup.
Change packages container to set to avoid duplicates.
Use RAII for McuSdkRepository.
Change-Id: I4b3f4156f0bc770c8a5ea8a171b1f22f6ffb8f96
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/mcusupport/mcupackage.cpp')
-rw-r--r-- | src/plugins/mcusupport/mcupackage.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/mcusupport/mcupackage.cpp b/src/plugins/mcusupport/mcupackage.cpp index 8719941448..36b479a6b2 100644 --- a/src/plugins/mcusupport/mcupackage.cpp +++ b/src/plugins/mcusupport/mcupackage.cpp @@ -239,10 +239,7 @@ bool McuPackage::writeToSettings() const QWidget *McuPackage::widget() { - if (m_widget) - return m_widget; - - m_widget = new QWidget; + auto *widget = new QWidget; m_fileChooser = new PathChooser; m_fileChooser->lineEdit()->setButtonIcon(FancyLineEdit::Right, Icons::RESET.icon()); m_fileChooser->lineEdit()->setButtonVisible(FancyLineEdit::Right, true); @@ -250,7 +247,7 @@ QWidget *McuPackage::widget() m_fileChooser->setFilePath(m_defaultPath); }); - auto layout = new QGridLayout(m_widget); + auto layout = new QGridLayout(widget); layout->setContentsMargins(0, 0, 0, 0); m_infoLabel = new InfoLabel(); @@ -277,7 +274,7 @@ QWidget *McuPackage::widget() }); updateStatus(); - return m_widget; + return widget; } McuToolChainPackage::McuToolChainPackage(const QString &label, |