1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

VerticalTabs: Correctly delete models when switching view type

This commit is contained in:
David Rosca 2018-02-02 17:28:56 +01:00
parent 68c30781bb
commit 05bb94adfe
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -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);