@@ -171,6 +171,7 @@ void LauncherModel::requestRemove(const QString &appId)
171171 m_list.at(index)->setPinned(false);
172172 QModelIndex modelIndex = this->index(index);
173173 Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
174+ storeAppList();
174175 return;
175176 }
176177
@@ -350,6 +351,7 @@ void LauncherModel::countVisibleChanged(const QString &appId, int countVisible)
350351
351352void LauncherModel::refresh()
352353{
354+ qDebug() << "calling refresh";
353355 // First walk through all the existing items and see if we need to remove something
354356 QList<LauncherItem*> toBeRemoved;
355357 Q_FOREACH (LauncherItem* item, m_list) {
@@ -368,8 +370,18 @@ void LauncherModel::refresh()
368370 }
369371 }
370372
373+ // If running, just unpin, otherwise really remove
371374 Q_FOREACH (LauncherItem* item, toBeRemoved) {
372− requestRemove(item->appId());
375+ int index = m_list.indexOf(item);
376+ if (m_appManager->findApplication(item->appId())) {
377+ item->setPinned(false);
378+ QModelIndex modelIndex = this->index(index);
379+ Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
380+ } else {
381+ beginRemoveRows(QModelIndex(), index, index);
382+ m_list.takeAt(index)->deleteLater();
383+ endRemoveRows();
384+ }
373385 }
374386
375387 // This brings the Launcher into sync with the settings backend again. There's an issue though: