Skip to content

Commit

Permalink
Stop monitoring seat changes if uid is set
Browse files Browse the repository at this point in the history
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 <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Apr 28, 2020
1 parent 5638f15 commit b6ff364
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/userinfo.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit b6ff364

Please sign in to comment.