From: Sune Vuorela Date: Thu, 13 Feb 2025 19:28:40 +0000 (+0000) Subject: [PATCH] users kcm: Fix issue in sorting user list X-Git-Tag: archive/raspbian/4%6.3.5-1+rpi1^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5de28b06b00af0ee546c5d9a5f6984f2c1c32ec1;p=plasma-workspace.git [PATCH] users kcm: Fix issue in sorting user list If two users are logged in, the sorting order is not stable, both should be sorted before the other Use partition instead of sorting, since we only care about having moved logged in users up front. Found by: Kamil Kaznowski Gbp-Pq: Name upstream_fbb2e6d3_users-kcm-Fix-issue-in-sorting-user-list.patch --- diff --git a/kcms/users/src/usermodel.cpp b/kcms/users/src/usermodel.cpp index 9b3fc0fd..8be29965 100644 --- a/kcms/users/src/usermodel.cpp +++ b/kcms/users/src/usermodel.cpp @@ -82,8 +82,8 @@ UserModel::UserModel(QObject *parent) m_userList.append(user); } - std::ranges::sort(m_userList, [](User *lhs, User *) { - return lhs->loggedIn(); + std::ranges::stable_partition(m_userList, [](User *u) { + return u->loggedIn(); }); connect(this, &QAbstractItemModel::rowsInserted, this, &UserModel::moreThanOneAdminUserChanged);