windowManager: listen actively to windows being destroyed during WS switch

Prevents gjs from dealing with already dispose()d objects.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/539
This commit is contained in:
Carlos Garnacho 2018-09-06 21:50:21 +02:00 committed by Florian Müllner
parent 2d791a51c0
commit b087752b55

View File

@ -1910,6 +1910,14 @@ var WindowManager = new Lang.Class({
actor.visible = visible;
}
}
for (let i = 0; i < switchData.windows.length; i++) {
let w = switchData.windows[i];
w.windowDestroyId = w.window.connect('destroy', () => {
switchData.windows.splice(switchData.windows.indexOf(w), 1);
});
}
},
_finishWorkspaceSwitch(switchData) {
@ -1917,9 +1925,8 @@ var WindowManager = new Lang.Class({
for (let i = 0; i < switchData.windows.length; i++) {
let w = switchData.windows[i];
if (w.window.is_destroyed()) // Window gone
continue;
w.window.disconnect(w.windowDestroyId);
w.window.reparent(w.parent);
if (w.window.get_meta_window().get_workspace() !=