diff --git a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js index 7b0c524..d49f5cb 100644 --- a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js +++ b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js @@ -257,7 +257,12 @@ export default class TilingMoveHandler { _onMoveFinished(window) { try { - window.assertExistence(); + // Ignore the expected error when the window was destroyed during the grab. + try { + window.assertExistence(); + } catch { + return; + } if (this._tileRect) { // Ctrl-drag to replace some windows in a tile group / create a new tile group @@ -293,6 +298,12 @@ export default class TilingMoveHandler { this._dragSprite = null; } } finally { + // Leaving it pending would re-enter _edgeTilingPreview() on a destroyed window + if (this._latestMonitorLockTimerId) { + GLib.Source.remove(this._latestMonitorLockTimerId); + this._latestMonitorLockTimerId = null; + } + if (this._posChangedId) { window.disconnect(this._posChangedId); this._posChangedId = 0; @@ -497,7 +508,8 @@ export default class TilingMoveHandler { // Only update the monitorNr, if the latest timer timed out. if (timerId === this._latestMonitorLockTimerId) { this._monitorNr = global.display.get_current_monitor(); - if (global.display.is_grabbed()) + // check that the window still exists, and a grab is still active + if (global.display.is_grabbed() && window.get_compositor_private()) this._edgeTilingPreview(window, grabOp); }