From ff8d8c4d45295a200c5f463148dd60cceeb7c3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Thu, 11 Apr 2019 13:51:15 +0200 Subject: [PATCH] Stability: null out destroyed actors Acting on destroyed actors crashes 3.32 so make sure to null out references. --- liveAltTab.js | 3 +++ minimap.js | 1 + navigator.js | 1 + stackoverlay.js | 18 ++++++++++++------ tiling.js | 12 ++++++++++-- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/liveAltTab.js b/liveAltTab.js index d085461..1699dc8 100644 --- a/liveAltTab.js +++ b/liveAltTab.js @@ -103,6 +103,7 @@ class LiveAltTab extends AltTab.WindowSwitcherPopup { let to = this._switcherList.windows[num]; this.clone && this.clone.destroy(); + this.clone = null; let actor = to.get_compositor_private(); let frame = to.get_frame_rect(); @@ -152,8 +153,10 @@ class LiveAltTab extends AltTab.WindowSwitcherPopup { transition: 'easeInOutQuad', onComplete: () => { this.fog.destroy(); + this.fog = null; // this.space.cloneContainer.remove_effect(this.blur); this.clone && this.clone.destroy(); + this.clone = null; this.space.moveDone(); } }); diff --git a/minimap.js b/minimap.js index 24a3e05..d99f064 100644 --- a/minimap.js +++ b/minimap.js @@ -288,5 +288,6 @@ class Minimap extends Array { this.signals.destroy(); this.splice(0,this.length); this.actor.destroy(); + this.actor = null; } } diff --git a/navigator.js b/navigator.js index 0b9a1ef..5fc90e9 100644 --- a/navigator.js +++ b/navigator.js @@ -171,6 +171,7 @@ var ActionDispatcher = class { Mainloop.source_remove(this._noModsTimeoutId); Main.popModal(this.actor); this.actor.destroy(); + this.actor = null; // We have already destroyed the navigator !this._destroy && this.navigator.destroy(); } diff --git a/stackoverlay.js b/stackoverlay.js index ef5feff..7a1956f 100644 --- a/stackoverlay.js +++ b/stackoverlay.js @@ -143,8 +143,10 @@ class ClickOverlay { for (let overlay of [this.left, this.right]) { let actor = overlay.overlay; overlay.signals.destroy(); - if (overlay.clone) + if (overlay.clone) { overlay.clone.destroy(); + overlay.clone = null; + } actor.destroy(); overlay.removeBarrier(); } @@ -175,8 +177,10 @@ var StackOverlay = class StackOverlay { this.signals = new utils.Signals(); this.signals.connect(overlay, 'button-release-event', () => { Main.activateWindow(this.target); - if (this.clone) + if (this.clone) { this.clone.destroy(); + this.clone = null; + } return true; }); @@ -197,8 +201,10 @@ var StackOverlay = class StackOverlay { if ("_previewId" in this) return; this._previewId = Mainloop.timeout_add(100, () => { - if (this.clone) + if (this.clone) { this.clone.destroy(); + this.clone = null; + } let [x, y, mask] = global.get_pointer(); let actor = this.target.get_compositor_private(); @@ -230,7 +236,7 @@ var StackOverlay = class StackOverlay { return; this.clone.destroy(); - delete this.clone; + this.clone = null; let space = Tiling.spaces.spaceOfWindow(this.target); // Show the WindowActors again and re-apply clipping space.moveDone(); @@ -290,9 +296,9 @@ var StackOverlay = class StackOverlay { setTarget(space, index) { - if (this.clone && this.clone.mapped) { + if (this.clone) { this.clone.destroy(); - delete this.clone; + this.clone = null; } let bail = () => { diff --git a/tiling.js b/tiling.js index 6dcff58..de5753e 100644 --- a/tiling.js +++ b/tiling.js @@ -1047,8 +1047,11 @@ class Space extends Array { destroy() { this.signals.destroy(); this.background.destroy(); + this.background = null; this.cloneContainer.destroy(); + this.cloneContainer = null; this.clip.destroy(); + this.cloneContainer = null; let workspace = this.workspace; } } @@ -1267,8 +1270,10 @@ class Spaces extends Map { let actor = metaWindow.get_compositor_private(); actor.remove_clip(); - if (metaWindow.clone) + if (metaWindow.clone) { metaWindow.clone.destroy(); + metaWindow.clone = null; + } if (metaWindow.get_workspace() === workspaceManager.get_active_workspace() && !metaWindow.minimized) @@ -1287,6 +1292,7 @@ class Spaces extends Map { } this.spaceContainer.destroy(); + this.spaceContainer = null; } workspacesChanged() { @@ -1838,8 +1844,10 @@ function remove_handler(workspace, meta_window) { let actor = meta_window.get_compositor_private(); if (!actor) { signals.disconnect(meta_window); - if (meta_window.clone && meta_window.clone.mapped) + if (meta_window.clone && meta_window.clone.mapped) { meta_window.clone.destroy(); + meta_window.clone = null; + } } }