From 522a5fe480c45fb35dbe7fe7e2fc48560ad608b5 Mon Sep 17 00:00:00 2001 From: verdre Date: Tue, 17 Apr 2018 14:51:20 +0200 Subject: [PATCH] loginDialog: Ensure old timed login timeout is removed before starting a new one Normally, we give the user a 5 second grace period of inactivity before starting a timed login operation. Unfortunately, that grace period timeout isn't properly removed if the timed login operation is restarted during the grace period. That means the timeout handler can inadvertently get called multiple times leading to the grace period duration getting subtracted from the total animation time more than once. This commit ensures we only ever have one grace period timeout scheduled at a time. --- js/gdm/loginDialog.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index dc5eaa235..017947689 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -1010,6 +1010,7 @@ var LoginDialog = new Lang.Class({ this._timedLoginIdleTimeOutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, _TIMED_LOGIN_IDLE_THRESHOLD, () => { this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD; + this._timedLoginIdleTimeOutId = 0; hold.release(); return GLib.SOURCE_REMOVE; }); @@ -1024,6 +1025,12 @@ var LoginDialog = new Lang.Class({ this._timedLoginBatch = null; } + // Reset previous idle-timeout + if (this._timedLoginIdleTimeOutId) { + GLib.source_remove(this._timedLoginIdleTimeOutId); + this._timedLoginIdleTimeOutId = 0; + } + this._timedLoginItem = null; this._timedLoginDelay = delay; this._timedLoginAnimationTime = delay;