From b6ff3647c1ffe9cfb43a51cbbc1547c1ee462d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= Date: Fri, 24 Apr 2020 14:23:15 +0300 Subject: [PATCH] Stop monitoring seat changes if uid is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Technically it would be possible to create UserInfo object in QML before activation has happened and then set it's uid to another user. In practice that's quite unusual thing to do. Previously it would have replaced the user with current user but now it just stops monitoring for changes instead. Signed-off-by: Tomi Leppänen --- src/userinfo.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/userinfo.cpp b/src/userinfo.cpp index e950675..2b5e9c8 100644 --- a/src/userinfo.cpp +++ b/src/userinfo.cpp @@ -564,6 +564,11 @@ void UserInfo::waitForActivation() auto *notifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(notifier, &QSocketNotifier::activated, this, [this, notifier, monitor](int socket) { Q_UNUSED(socket) + if (uid() != (int)UnknownCurrentUserId) { + // This user has been changed to someone else already, stop monitoring + qCDebug(lcUsersLog) << "UserInfo uid had been changed"; + notifier->deleteLater(); + } // Check if seat0 has got active user uid_t uid = InvalidId; if (sd_seat_get_active("seat0", NULL, &uid) >= 0 && uid != InvalidId) {