ScreenShield: properly handle ensureUnlockDialog() failure

If that fails (which only ever happens in initial-setup mode, which
has no unlock or login dialog), we don't want to go ahead with
whatever we were doing.

https://bugzilla.gnome.org/show_bug.cgi?id=701848
This commit is contained in:
Giovanni Campagna 2013-06-08 16:03:14 +02:00
parent 30ff15ec0b
commit 99af697cd7

View File

@ -583,7 +583,7 @@ const ScreenShield = new Lang.Class({
_liftShield: function(onPrimary, velocity) {
if (this._isLocked) {
this._ensureUnlockDialog(onPrimary, true /* allowCancel */);
if (this._ensureUnlockDialog(onPrimary, true /* allowCancel */))
this._hideLockScreen(true /* animate */, velocity);
} else {
this.deactivate(true /* animate */);
@ -621,9 +621,8 @@ const ScreenShield = new Lang.Class({
if (!isEnter && !(GLib.unichar_isprint(unichar) || symbol == Clutter.KEY_Escape))
return false;
this._ensureUnlockDialog(true, true);
if (GLib.unichar_isgraph(unichar))
if (this._ensureUnlockDialog(true, true) &&
GLib.unichar_isgraph(unichar))
this._dialog.addCharacter(unichar);
this._liftShield(true, 0);
@ -864,7 +863,7 @@ const ScreenShield = new Lang.Class({
this.actor.show();
this._isGreeter = Main.sessionMode.isGreeter;
this._isLocked = true;
this._ensureUnlockDialog(true, true);
if (this._ensureUnlockDialog(true, true))
this._hideLockScreen(false, 0);
},
@ -915,7 +914,7 @@ const ScreenShield = new Lang.Class({
if (!constructor) {
// This session mode has no locking capabilities
this.deactivate(true);
return;
return false;
}
this._dialog = new constructor(this._lockDialogGroup);
@ -927,12 +926,14 @@ const ScreenShield = new Lang.Class({
// by the time we reach this...
log('Could not open login dialog: failed to acquire grab');
this.deactivate(true);
return false;
}
this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
}
this._dialog.allowCancel = allowCancel;
return true;
},
_onUnlockFailed: function() {