diff --git a/logPlus/customtabwidget.cpp b/logPlus/customtabwidget.cpp index cd6e177..8aeecc7 100644 --- a/logPlus/customtabwidget.cpp +++ b/logPlus/customtabwidget.cpp @@ -112,7 +112,10 @@ int CustomTabWidget::insertTab(int index, QWidget *page, const QIcon &icon, cons void CustomTabWidget::removeTab(int index) { m_pTabBar->removeTab(index); - m_pStackedWidget->removeWidget(m_pStackedWidget->widget(index)); //widget is not deleted but simply removed from the stacked layout, causing it to be hidden. + + QWidget* pWgt = m_pStackedWidget->widget(index); + m_pStackedWidget->removeWidget(pWgt); //widget is not deleted but simply removed from the stacked layout, causing it to be hidden. + pWgt->deleteLater(); if (m_pTabBar->count() == 0) { emit tabIsEmpty();