PopupMenuManager: don't throw exceptions if don't have focus

stage.key_focus can be null, but passing null to _activeMenuContains
throws (from gjs marshalling). In that case, just assume it returned
false.

https://bugzilla.gnome.org/show_bug.cgi?id=642976
This commit is contained in:
Giovanni Campagna 2011-02-22 20:56:23 +01:00
parent 6207c68439
commit b9cb37da5e

View File

@ -1252,7 +1252,7 @@ PopupMenuManager.prototype = {
menu.sourceActor.grab_key_focus(); menu.sourceActor.grab_key_focus();
} else if (menu == this._activeMenu) { } else if (menu == this._activeMenu) {
let focus = global.stage.key_focus; let focus = global.stage.key_focus;
let fromActive = this._activeMenuContains(focus); let fromActive = focus && this._activeMenuContains(focus);
if (this.grabbed) if (this.grabbed)
this._ungrab(); this._ungrab();