Fix detaching

This commit is contained in:
Elvis Angelaccio 2018-04-01 12:23:08 +02:00
parent 763933977b
commit 6f3b0e3d00
2 changed files with 4 additions and 2 deletions

View file

@ -600,7 +600,8 @@ void PlacesItemModel::onSourceModelDataChanged(const QModelIndex &topLeft, const
void PlacesItemModel::onSourceModelGroupHiddenChanged(KFilePlacesModel::GroupType group, bool hidden)
{
for(const QModelIndex &sourceIndex : m_sourceModel->groupIndexes(group)) {
const auto groupIndexes = m_sourceModel->groupIndexes(group);
for (const QModelIndex &sourceIndex : groupIndexes) {
PlacesItem *item = placesItem(mapFromSource(sourceIndex));
if (item) {
item->setGroupHidden(hidden);

View file

@ -228,7 +228,8 @@ void PlacesItemModelTest::init()
void PlacesItemModelTest::cleanup()
{
for (int i : m_tobeRemoved) {
const auto tobeRemoved = m_tobeRemoved;
for (const int i : tobeRemoved) {
int before = m_model->count();
m_model->deleteItem(i);
QTRY_COMPARE(m_model->count(), before - 1);