From f955303e0a5df08e6a4df7f0b495e449b4c376f2 Mon Sep 17 00:00:00 2001 From: Morg Date: Thu, 21 Jan 2021 14:40:46 +0100 Subject: [PATCH] Make sure to delete QTabWidget after removal Commit amended for code style by Adam Honse --- qt/OpenRGBDialog2.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index 1402a61e2..c9a8a9f9e 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -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; } }