gdm: prevent nextSignalId from being connected multiply times

The problem is caused by '_askForUsernameAndBeginVerification' being
called multiply times. So when we click 'next', the old connected
function will also be executed.
This commit is contained in:
David Liang 2015-02-26 15:40:56 -05:00 committed by Ray Strode
parent ad92584b72
commit e23a03d639

View File

@ -473,6 +473,10 @@ const LoginDialog = new Lang.Class({
this._disableUserList = undefined; this._disableUserList = undefined;
this._userListLoaded = false; this._userListLoaded = false;
this._realmManager = new Realmd.Manager();
this._realmSignalId = this._realmManager.connect('login-format-changed',
Lang.bind(this, this._showRealmLoginHint));
LoginManager.getLoginManager().getCurrentSessionProxy(Lang.bind(this, this._gotGreeterSessionProxy)); LoginManager.getLoginManager().getCurrentSessionProxy(Lang.bind(this, this._gotGreeterSessionProxy));
// If the user list is enabled, it should take key focus; make sure the // If the user list is enabled, it should take key focus; make sure the
@ -826,25 +830,22 @@ const LoginDialog = new Lang.Class({
this._authPrompt.setPasswordChar(''); this._authPrompt.setPasswordChar('');
this._authPrompt.setQuestion(_("Username: ")); this._authPrompt.setQuestion(_("Username: "));
let realmManager = new Realmd.Manager(); this._showRealmLoginHint(this._realmManager.loginFormat);
let realmSignalId = realmManager.connect('login-format-changed',
Lang.bind(this, this._showRealmLoginHint));
this._showRealmLoginHint(realmManager.loginFormat);
let nextSignalId = this._authPrompt.connect('next', if (this._nextSignalId)
Lang.bind(this, function() { this._authPrompt.disconnect(this._nextSignalId);
this._authPrompt.disconnect(nextSignalId); this._nextSignalId = this._authPrompt.connect('next',
this._authPrompt.updateSensitivity(false); Lang.bind(this, function() {
let answer = this._authPrompt.getAnswer(); this._authPrompt.disconnect(this._nextSignalId);
this._user = this._userManager.get_user(answer); this._nextSignalId = 0;
this._authPrompt.clear(); this._authPrompt.updateSensitivity(false);
this._authPrompt.startSpinning(); let answer = this._authPrompt.getAnswer();
this._authPrompt.begin({ userName: answer }); this._user = this._userManager.get_user(answer);
this._updateCancelButton(); this._authPrompt.clear();
this._authPrompt.startSpinning();
realmManager.disconnect(realmSignalId) this._authPrompt.begin({ userName: answer });
realmManager.release(); this._updateCancelButton();
})); }));
this._updateCancelButton(); this._updateCancelButton();
this._authPrompt.updateSensitivity(true); this._authPrompt.updateSensitivity(true);
@ -1127,6 +1128,12 @@ const LoginDialog = new Lang.Class({
this._greeterSessionProxy.disconnect(this._greeterSessionProxyChangedId); this._greeterSessionProxy.disconnect(this._greeterSessionProxyChangedId);
this._greeterSessionProxy = null; this._greeterSessionProxy = null;
} }
if (this._realmManager) {
this._realmManager.disconnect(this._realmSignalId);
this._realmSignalId = 0;
this._realmManager.release();
this._realmManager = null;
}
}, },
_loadUserList: function() { _loadUserList: function() {