diff --git a/pglab/CrudTab.cpp b/pglab/CrudTab.cpp index f44b0a1..c50d7c8 100644 --- a/pglab/CrudTab.cpp +++ b/pglab/CrudTab.cpp @@ -28,7 +28,7 @@ CrudTab::CrudTab(IDatabaseWindow *context, QWidget *parent) auto delegate = new PgLabItemDelegate(ui->tableView); ui->tableView->setItemDelegate(delegate); - m_crudModel = new CrudModel(parent); + m_crudModel = new CrudModel(nullptr); m_SortFilterProxy = new QSortFilterProxyModel(this); m_SortFilterProxy->setSourceModel(m_crudModel); @@ -48,6 +48,7 @@ CrudTab::CrudTab(IDatabaseWindow *context, QWidget *parent) CrudTab::~CrudTab() { + delete m_crudModel; delete ui; } diff --git a/pglab/DatabaseWindow.cpp b/pglab/DatabaseWindow.cpp index a8dbf57..201a414 100644 --- a/pglab/DatabaseWindow.cpp +++ b/pglab/DatabaseWindow.cpp @@ -281,8 +281,11 @@ void DatabaseWindow::closeTab(int index) if (index < 0) return; - if (canCloseTab(index)) + if (canCloseTab(index)) { + QWidget *widget = m_tabWidget->widget(index); m_tabWidget->removeTab(index); + delete widget; + } } bool DatabaseWindow::canCloseTab(int index) const