From de8876bd5ed35d82b9d38bc403ac1682d8954675 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: (cherry picked from commit 8318ea919f2d01b12e5c14047fca02d4333be720) --- 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 3c45d002..8babbaeb 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -787,9 +787,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), }; @@ -1017,11 +1017,11 @@ class WindowList extends St.Widget { } } - _onDragBegin() { + _monitorDrag() { DND.addDragMonitor(this._dragMonitor); } - _onDragEnd() { + _stopMonitoringDrag() { DND.removeDragMonitor(this._dragMonitor); this._removeActivateTimeout(); } @@ -1095,6 +1095,7 @@ class WindowList extends St.Widget { global.display.disconnect(this._fullscreenChangedId); + this._stopMonitoringDrag(); Main.xdndHandler.disconnect(this._dragBeginId); Main.xdndHandler.disconnect(this._dragEndId);