window-list: Explicitly dispose settings on destroy

This will not only disconnect the signal handler, but also remove
any bindings. This works around a crash that happens if a setting
that triggers the binding changes at the same time as a setting
that rebuilds the window list; in that case, the binding handler
runs after gjs has dropped its wrapper object, but before the
binding is removed automaticalled when the object is finalized.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/416

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/243>
This commit is contained in:
Florian Müllner
2022-09-30 18:16:16 +02:00
parent 77b35dcda3
commit cc72a34973
+3 -3
View File
@@ -860,8 +860,8 @@ class WindowList extends St.Widget {
this._dndWindow = null;
this._settings = ExtensionUtils.getSettings();
this._groupingModeChangedId = this._settings.connect(
'changed::grouping-mode', this._groupingModeChanged.bind(this));
this._settings.connect('changed::grouping-mode',
() => this._groupingModeChanged());
this._grouped = undefined;
this._groupingModeChanged();
}
@@ -1130,7 +1130,7 @@ class WindowList extends St.Widget {
Main.xdndHandler.disconnect(this._dragBeginId);
Main.xdndHandler.disconnect(this._dragEndId);
this._settings.disconnect(this._groupingModeChangedId);
this._settings.run_dispose();
let windows = global.get_window_actors();
for (let i = 0; i < windows.length; i++)