layout: Disconnect 'monitors-changed' handler on shutdown

Doing it ourselves in the shutdown handler in layout.js means we won't
risk reacting to monitor changes that happen after gnome-shell prepares
to shutdown and the signal handler would disconnect itself in case we
used `connectObject(..)`.

This will currently never happen, but in the future perf tests will be
able to create virtual monitors for testing purposes, and they might get
destroyed during the shutdown procedures, causing us to react to them
when we shouldn't.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2623>
This commit is contained in:
Jonas Ådahl 2023-02-02 15:36:49 +01:00 committed by Marge Bot
parent 9d75d777c7
commit 7f7ec2a866

View File

@ -222,6 +222,9 @@ var LayoutManager = GObject.registerClass({
global.stage.remove_actor(global.window_group);
this.uiGroup.add_actor(global.window_group);
global.connect('shutdown', () => {
const monitorManager = global.backend.get_monitor_manager();
monitorManager.disconnectObject(this);
const adoptedUiGroupActors = [
global.window_group,
global.top_window_group,
@ -330,8 +333,9 @@ var LayoutManager = GObject.registerClass({
this._updateFullscreen.bind(this));
const monitorManager = global.backend.get_monitor_manager();
monitorManager.connect('monitors-changed',
this._monitorsChanged.bind(this));
monitorManager.connectObject(
'monitors-changed', this._monitorsChanged.bind(this),
this);
this._monitorsChanged();
this.screenTransition = new ScreenTransition();