unlockDialog: Defend against absence of blur effect

widget.get_effect(...) can return null while locking the screen, resulting
in a TypeError. In this situation the screen ends up black with a cursor
but never going to sleep, and moving the mouse brings the old screen
contents up but does not allow unlocking.

unlockDialog.js assumes that widget.get_effect will return non-null,
but other places such as getWindowDimmer in windowManager.js go out of
their way to be more careful.

[smcv: Add commit message, remove hard tabs, add missing semicolon]

Resolves: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3071
Bug-Debian: https://bugs.debian.org/968440
This commit is contained in:
Zephaniah E. Loss-Cutler-Hull 2020-08-15 03:23:27 -07:00 committed by Florian Müllner
parent b436f3ebcb
commit 093603b35e

View File

@ -647,12 +647,16 @@ var UnlockDialog = GObject.registerClass({
const themeContext = St.ThemeContext.get_for_stage(global.stage); const themeContext = St.ThemeContext.get_for_stage(global.stage);
for (const widget of this._backgroundGroup) { for (const widget of this._backgroundGroup) {
widget.get_effect('blur').set({ const effect = widget.get_effect('blur');
if (effect) {
effect.set({
brightness: BLUR_BRIGHTNESS, brightness: BLUR_BRIGHTNESS,
sigma: BLUR_SIGMA * themeContext.scale_factor, sigma: BLUR_SIGMA * themeContext.scale_factor,
}); });
} }
} }
}
_updateBackgrounds() { _updateBackgrounds() {
for (let i = 0; i < this._bgManagers.length; i++) for (let i = 0; i < this._bgManagers.length; i++)