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>
This commit is contained in:
Piotr Mućko
2022-03-28 16:42:51 +02:00
parent 652f130fae
commit a3fbfac814
19 changed files with 229 additions and 265 deletions

View File

@@ -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,