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




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

    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: <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]