forked from qt-creator/qt-creator
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:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user