From 05bb94adfe1b895c78b38c67028c1715efd90350 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 2 Feb 2018 17:28:56 +0100 Subject: [PATCH] VerticalTabs: Correctly delete models when switching view type --- src/plugins/VerticalTabs/verticaltabswidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/VerticalTabs/verticaltabswidget.cpp b/src/plugins/VerticalTabs/verticaltabswidget.cpp index 5fddb5f15..66e77fa8e 100644 --- a/src/plugins/VerticalTabs/verticaltabswidget.cpp +++ b/src/plugins/VerticalTabs/verticaltabswidget.cpp @@ -53,6 +53,8 @@ void VerticalTabsWidget::setViewType(VerticalTabsPlugin::ViewType type) TabFilterModel *model = new TabFilterModel(m_normalView); model->setFilterPinnedTabs(true); + delete m_normalView->model(); + switch (type) { case VerticalTabsPlugin::TabListView: model->setSourceModel(m_window->tabModel()); @@ -61,8 +63,7 @@ void VerticalTabsWidget::setViewType(VerticalTabsPlugin::ViewType type) break; case VerticalTabsPlugin::TabTreeView: - delete m_treeModel; - m_treeModel = new TabTreeModel(this); + m_treeModel = new TabTreeModel(model); m_treeModel->setSourceModel(m_window->tabModel()); model->setSourceModel(m_treeModel); m_normalView->setModel(model);