diff --git a/libtaskmanager/tasksmodel.cpp b/libtaskmanager/tasksmodel.cpp index ad412555b..c881369cb 100644 --- a/libtaskmanager/tasksmodel.cpp +++ b/libtaskmanager/tasksmodel.cpp @@ -552,8 +552,15 @@ void TasksModel::Private::updateManualSortMap() const QModelIndex &concatProxyIndex = concatProxyModel->index(sortedPreFilterRows.at(i), 0); if (appsMatch(concatProxyIndex, idx)) { - sortedPreFilterRows.move(row, i + 1); - moved = true; + // Our sort map contains row indices prior to any filtering, but we don't + // want to sort new tasks in next to siblings we're filtering out higher up + // in the proxy chain, so check in with the filter model. + const QModelIndex &filterProxyIndex = filterProxyModel->mapFromSource(concatProxyIndex); + + if (filterProxyIndex.isValid()) { + sortedPreFilterRows.move(row, i + 1); + moved = true; + } break; }