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,14 +830,14 @@ 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)
this._authPrompt.disconnect(this._nextSignalId);
this._nextSignalId = this._authPrompt.connect('next',
Lang.bind(this, function() { Lang.bind(this, function() {
this._authPrompt.disconnect(nextSignalId); this._authPrompt.disconnect(this._nextSignalId);
this._nextSignalId = 0;
this._authPrompt.updateSensitivity(false); this._authPrompt.updateSensitivity(false);
let answer = this._authPrompt.getAnswer(); let answer = this._authPrompt.getAnswer();
this._user = this._userManager.get_user(answer); this._user = this._userManager.get_user(answer);
@ -841,9 +845,6 @@ const LoginDialog = new Lang.Class({
this._authPrompt.startSpinning(); this._authPrompt.startSpinning();
this._authPrompt.begin({ userName: answer }); this._authPrompt.begin({ userName: answer });
this._updateCancelButton(); this._updateCancelButton();
realmManager.disconnect(realmSignalId)
realmManager.release();
})); }));
this._updateCancelButton(); this._updateCancelButton();
@ -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() {