Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions liteidex/src/utils/folderview/abstractmultiproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ AbstractMultiProxyModel::AbstractMultiProxyModel(AbstractMultiProxyModelPrivate
*/
AbstractMultiProxyModel::~AbstractMultiProxyModel()
{

Q_D(AbstractMultiProxyModel);
foreach (const SourceModelIndex &source, d->indexList) {
disconnect(source.model, 0, d, 0);
}
delete d_ptr;
d_ptr = 0;
}

/*!
Expand Down Expand Up @@ -94,7 +99,7 @@ bool AbstractMultiProxyModel::removeSourceModel(QAbstractItemModel *sourceModel)
SourceModelIndex index = i.next();
if (index.model == sourceModel) {
this->beginRemoveRows(QModelIndex(),n,n);
disconnect(sourceModel,0,this,0);
disconnect(sourceModel,0,d,0);
i.remove();
this->endRemoveRows();
return true;
Expand All @@ -109,7 +114,7 @@ void AbstractMultiProxyModel::removeAllSourceModel()
this->beginResetModel();
Q_D(AbstractMultiProxyModel);
foreach (SourceModelIndex si, d->indexList) {
disconnect(si.model,0,this,0);
disconnect(si.model,0,d,0);
}
d->indexList.clear();
this->endResetModel();
Expand Down
4 changes: 3 additions & 1 deletion liteidex/src/utils/folderview/multifoldermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ MultiFolderModel::MultiFolderModel(QObject *parent)

MultiFolderModel::~MultiFolderModel()
{

// Source models emit model signals during destruction. Remove and delete
// them while this proxy and its private signal receiver are still valid.
clearAll();
}

QModelIndex MultiFolderModel::addRootPath(const QString &path)
Expand Down
6 changes: 6 additions & 0 deletions liteidex/src/utils/folderview/multifolderview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ MultiFolderView::MultiFolderView(LiteApi::IApplication *app, QWidget *parent)

MultiFolderView::~MultiFolderView()
{
// QTreeView owns persistent indexes for the current model. Reset them and
// destroy the model before QTreeView starts tearing down its private data.
m_model->clearAll();
setModel(0);
delete m_model;
m_model = 0;
}

void MultiFolderView::setFilter(QDir::Filters filters)
Expand Down
Loading