From bd02faa982c263205b5cc21d6ceb4225a83c76b5 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 17 May 2012 13:32:09 +0200 Subject: KStandardItemModel: Fix inconsistent internal state Assure that the index-cache is kept consistent with the items when a removing or inserting is done. A unit-test will be created as soon as possible. --- src/panels/places/placesitemmodel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/panels') diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 21cbf9ed3..14ec54be8 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -395,7 +395,7 @@ void PlacesItemModel::onItemChanged(int index, const QSet& changedRo { const PlacesItem* changedItem = placesItem(index); if (changedItem) { - // Take care to apply the PlacesItemModel-order of the inserted item + // Take care to apply the PlacesItemModel-order of the changed item // also to the bookmark-manager. const KBookmark insertedBookmark = changedItem->bookmark(); @@ -409,9 +409,7 @@ void PlacesItemModel::onItemChanged(int index, const QSet& changedRo } if (changedRoles.contains("isHidden")) { - const PlacesItem* shownItem = placesItem(index); - Q_ASSERT(shownItem); - if (!m_hiddenItemsShown && shownItem->isHidden()) { + if (!m_hiddenItemsShown && changedItem->isHidden()) { m_hiddenItemToRemove = index; QTimer::singleShot(0, this, SLOT(hideItem())); } -- cgit v1.3