[gnome-shell] appDisplay: Disconnect Main item-drag signals on icons destruction



commit 35dbc3fcc9e607b9461476022216beb79d15bb0c
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Fri Aug 9 23:27:57 2019 +0200

    appDisplay: Disconnect Main item-drag signals on icons destruction
    
    Icons connect to overview's item-drag events to react to start/end drags,
    however the icons should disconnect from signals once destroyed.
    
    So, disconnect from Main events once the actors have been destroyed.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1511
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/677

 js/ui/appDisplay.js | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9a81887480..50b8fd9b9d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1433,10 +1433,10 @@ var FolderIcon = class FolderIcon {
 
         this.view = new FolderView(this._folder, id, parentView);
 
-        Main.overview.connect('item-drag-begin',
-                              this._onDragBegin.bind(this));
-        Main.overview.connect('item-drag-end',
-                              this._onDragEnd.bind(this));
+        this._itemDragBeginId = Main.overview.connect(
+            'item-drag-begin', this._onDragBegin.bind(this));
+        this._itemDragEndId = Main.overview.connect(
+            'item-drag-end', this._onDragEnd.bind(this));
 
         this.actor.connect('clicked', this.open.bind(this));
         this.actor.connect('destroy', this.onDestroy.bind(this));
@@ -1450,6 +1450,9 @@ var FolderIcon = class FolderIcon {
     }
 
     onDestroy() {
+        Main.overview.disconnect(this._itemDragBeginId);
+        Main.overview.disconnect(this._itemDragEndId);
+
         this.view.actor.destroy();
 
         if (this._spaceReadySignalId) {
@@ -1870,8 +1873,10 @@ var AppIcon = class AppIcon {
             });
         }
 
-        Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
-        Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+        this._itemDragBeginId = Main.overview.connect(
+            'item-drag-begin', this._onDragBegin.bind(this));
+        this._itemDragEndId = Main.overview.connect(
+            'item-drag-end', this._onDragEnd.bind(this));
 
         this.actor.connect('destroy', this._onDestroy.bind(this));
 
@@ -1883,6 +1888,9 @@ var AppIcon = class AppIcon {
     }
 
     _onDestroy() {
+        Main.overview.disconnect(this._itemDragBeginId);
+        Main.overview.disconnect(this._itemDragEndId);
+
         if (this._folderPreviewId > 0) {
             GLib.source_remove(this._folderPreviewId);
             this._folderPreviewId = 0;


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