[gnome-shell-extensions/wip/fix-window-list-leak] window-list: Stop monitoring drag operation if window disappears




commit acce5fa1231e12bf8f5e4343cf440d669ec7761a
Author: Ray Strode <rstrode redhat com>
Date:   Tue Nov 24 00:24:55 2020 -0500

    window-list: Stop monitoring drag operation if window disappears
    
    If a user is in the middle of a drag in the window list when the
    window associated with that drag gets destroyed, the drag monitor
    gets leaked.
    
    Later when the drag motion is processed, this spew goes to the log
    
    clutter_actor_contains: assertion 'CLUTTER_IS_ACTOR (self)' failed
    
    This commit fixes the spew and the leak by ensuring any pending
    drag monitoring is disabled when the window is destroyed.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/145

 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 616bec6..a7a7a5e 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]