McuSupport: Delete unused widgets

The takeRow() function does not delete any widget. New rows are inserted
using newly created widgets. This results in a memory leak of hidden
widgets.
This change deletes the widgets when removing them from the layout.

Change-Id: Idda877c3cf5c20fc40bfbedb26da11270752e821
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Rainer Keller
2022-10-17 08:16:47 +02:00
parent cb1ca97ded
commit 3499cd79c7

View File

@@ -251,9 +251,7 @@ void McuSupportOptionsWidget::showMcuTargetPackages()
return;
while (m_packagesLayout->rowCount() > 0) {
QFormLayout::TakeRowResult row = m_packagesLayout->takeRow(0);
row.labelItem->widget()->hide();
row.fieldItem->widget()->hide();
m_packagesLayout->removeRow(0);
}
for (const auto &package : std::as_const(m_options.sdkRepository.packages)) {