diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 8e7e7a6e5..49d70355c 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1763,6 +1763,14 @@ var WindowManager = new Lang.Class({ } } + 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); + }); + } + switchData.inGroup.set_position(-xDest, -yDest); switchData.inGroup.raise_top(); @@ -1793,8 +1801,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); + if (w.window.get_parent() == switchData.outGroup) { w.window.reparent(w.parent); w.window.hide();