From 8318ea919f2d01b12e5c14047fca02d4333be720 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 24 Nov 2020 00:24:55 -0500 Subject: [PATCH] window-list: Stop monitoring drag operation if window list is destroyed If a user is in the middle of a drag in the window list and the window list associated with the drag gets destroyed, the drag monitor gets leaked. Later when the drag motion is processed, spew goes to the log: clutter_actor_contains: assertion 'CLUTTER_IS_ACTOR (self)' failed Examples of triggers for this bug: - The monitor topology changes - The screen gets locked during the drag This commit fixes the spew and the leak by ensuring any pending drag monitoring is disabled when the window lists are destroyed. Part-of: --- extensions/window-list/extension.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 616bec60..a7a7a5e2 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -786,9 +786,9 @@ class WindowList extends St.Widget { }); this._dragBeginId = Main.xdndHandler.connect('drag-begin', - this._onDragBegin.bind(this)); + this._monitorDrag.bind(this)); this._dragEndId = Main.xdndHandler.connect('drag-end', - this._onDragEnd.bind(this)); + this._stopMonitoringDrag.bind(this)); this._dragMonitor = { dragMotion: this._onDragMotion.bind(this), }; @@ -1016,11 +1016,11 @@ class WindowList extends St.Widget { } } - _onDragBegin() { + _monitorDrag() { DND.addDragMonitor(this._dragMonitor); } - _onDragEnd() { + _stopMonitoringDrag() { DND.removeDragMonitor(this._dragMonitor); this._removeActivateTimeout(); } @@ -1094,6 +1094,7 @@ class WindowList extends St.Widget { global.display.disconnect(this._fullscreenChangedId); + this._stopMonitoringDrag(); Main.xdndHandler.disconnect(this._dragBeginId); Main.xdndHandler.disconnect(this._dragEndId);