ScreenShield: fix code to detect missing unlock dialog

If the session mode has no locking support, screenshield had code to
unlock automatically, but it did so by checking the return value of
the constructor, instead of checking if the constructor was actually
callable, so it would get a TypeError before reaching the check.

https://bugzilla.gnome.org/show_bug.cgi?id=687708
This commit is contained in:
Giovanni Campagna 2012-11-06 23:41:51 +01:00
parent 50f96d1c9c
commit 271508c0a8

View File

@ -713,13 +713,15 @@ const ScreenShield = new Lang.Class({
_ensureUnlockDialog: function(onPrimary) {
if (!this._dialog) {
let constructor = Main.sessionMode.unlockDialog;
this._dialog = new constructor(this._lockDialogGroup);
if (!this._dialog) {
if (!constructor) {
// This session mode has no locking capabilities
this.unlock();
return;
}
this._dialog = new constructor(this._lockDialogGroup);
let time = global.get_current_time();
this._dialog.connect('loaded', Lang.bind(this, function() {
if (!this._dialog.open(time, onPrimary)) {