Make sure to delete QTabWidget after removal

Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
Morg
2021-01-21 14:40:46 +01:00
committed by Adam Honse
parent addd173944
commit f955303e0a

View File

@@ -741,7 +741,12 @@ void OpenRGBDialog2::UpdateDevicesList()
unsigned int tab_count = ui->DevicesTabBar->count();
for(unsigned int tab_idx = controllers.size(); tab_idx < tab_count; tab_idx++)
{
ui->DevicesTabBar->removeTab(ui->DevicesTabBar->count() - 1);
unsigned int remove_idx = ui->DevicesTabBar->count() - 1;
QWidget* tab_widget = ui->DevicesTabBar->widget(remove_idx);
ui->DevicesTabBar->removeTab(remove_idx);
delete tab_widget;
}
bool found = true;
@@ -759,7 +764,11 @@ void OpenRGBDialog2::UpdateDevicesList()
if(type_str == "Ui::OpenRGBDeviceInfoPage")
{
found = true;
QWidget* tab_widget = ui->InformationTabBar->widget(tab_idx);
ui->InformationTabBar->removeTab(tab_idx);
delete tab_widget;
break;
}
}