[gnome-shell/wip/carlosg/spurious-window-drags: 2/4] swipeTracker: Disconnect all remaining gestures on destruction




commit 31d466d48a064a1d8b671e5cebacf394da4c77be
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Oct 4 18:01:59 2022 +0200

    swipeTracker: Disconnect all remaining gestures on destruction
    
    The destroy() handler is a bit inconsistent, since there are other
    "gestures" that do need disconnecting their signals from other
    objects.
    
    Remove the remaining gestures as well, so that the SwipeTracker
    can be cleanly detached from the related actor.

 js/ui/swipeTracker.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index 7de8b38d63..5475d868d4 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -329,6 +329,7 @@ const ScrollGesture = GObject.registerClass({
         this._allowedModes = allowedModes;
         this._began = false;
         this._enabled = true;
+        this._actor = actor;
 
         actor.connect('scroll-event', this._handleEvent.bind(this));
     }
@@ -398,6 +399,10 @@ const ScrollGesture = GObject.registerClass({
 
         return Clutter.EVENT_STOP;
     }
+
+    destroy() {
+        this._actor.disconnectObject(this);
+    }
 });
 
 // USAGE:
@@ -784,5 +789,15 @@ var SwipeTracker = GObject.registerClass({
             this._actor.remove_action(this._touchGesture);
             delete this._touchGesture;
         }
+
+        if (this._dragGesture) {
+            this._actor.remove_action(this._dragGesture);
+            delete this._dragGesture;
+        }
+
+        if (this._scrollGesture) {
+            this._scrollGesture.destroy();
+            delete this._scrollGesture;
+        }
     }
 });


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