Commit c2539104 authored by Peter Penz's avatar Peter Penz
Browse files

Fix crash when closing Dolphin during generating previews

BUG: 299108
FIXED-IN: 4.9.0
parent ebdf0e8d
......@@ -66,8 +66,6 @@ KFileItemListView::KFileItemListView(QGraphicsWidget* parent) :
KFileItemListView::~KFileItemListView()
{
delete m_modelRolesUpdater;
m_modelRolesUpdater = 0;
}
void KFileItemListView::setPreviewsShown(bool show)
......
......@@ -75,12 +75,10 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v
KItemListController::~KItemListController()
{
setView(0);
delete m_view;
m_view = 0;
Q_ASSERT(!m_view);
setModel(0);
delete m_model;
m_model = 0;
Q_ASSERT(!m_model);
}
void KItemListController::setModel(KItemModelBase* model)
......@@ -90,6 +88,10 @@ void KItemListController::setModel(KItemModelBase* model)
}
KItemModelBase* oldModel = m_model;
if (oldModel) {
oldModel->deleteLater();
}
m_model = model;
if (m_model) {
m_model->setParent(this);
......@@ -123,11 +125,13 @@ void KItemListController::setView(KItemListView* view)
KItemListView* oldView = m_view;
if (oldView) {
disconnect(oldView, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
oldView->deleteLater();
}
m_view = view;
if (m_view) {
m_view->setParent(this);
m_view->setController(this);
m_view->setModel(m_model);
connect(m_view, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
......
......@@ -761,13 +761,8 @@ void KItemListView::onControllerChanged(KItemListController* current, KItemListC
void KItemListView::onModelChanged(KItemModelBase* current, KItemModelBase* previous)
{
Q_UNUSED(current);
Q_UNUSED(previous);
m_sizeHintResolver->clearCache();
const int itemCount = current->count();
if (itemCount > 0) {
m_sizeHintResolver->itemsInserted(0, itemCount);
}
}
void KItemListView::onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous)
......@@ -1446,6 +1441,8 @@ void KItemListView::setModel(KItemModelBase* model)
this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
}
m_sizeHintResolver->clearCache();
m_model = model;
m_layouter->setModel(model);
m_grouped = model->groupedSorting();
......@@ -1468,6 +1465,7 @@ void KItemListView::setModel(KItemModelBase* model)
const int itemCount = m_model->count();
if (itemCount > 0) {
m_sizeHintResolver->itemsInserted(0, itemCount);
slotItemsInserted(KItemRangeList() << KItemRange(0, itemCount));
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment