extensionSystem: Remove "disable" file on shutdown

The file indicates to the systemd shutdown scripts that extensions
should be disabled, so that extensions that crash the shell on
startup cannot lock out the user indefinitely.

For that purpose, we create the file before initializing extensions,
and remove it after 60 seconds. That generally works, because it's
highly unlikely that a session genuinely ends within the first minute.

It's possible though (for example during developments or when running
tests), so also remove the file when shutting down cleanly before
the timeout.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2807>
This commit is contained in:
Florian Müllner 2023-06-12 23:28:54 +02:00 committed by Marge Bot
parent 393d9df375
commit 1f08056977

View File

@ -57,7 +57,12 @@ var ExtensionManager = class extends Signals.EventEmitter {
log(`Failed to create file ${disableFilename}: ${e.message}`);
}
const shutdownId = global.connect('shutdown',
() => disableFile.delete(null));
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => {
global.context.disconnect(shutdownId);
disableFile.delete(null);
return GLib.SOURCE_REMOVE;
});