[gnome-shell] appDisplay: Disconnect folder "changed" signal when actors are destroyed



commit 989c0ee49e392ae00e7c15bc9c15cee92d119eea
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Mon Feb 17 15:40:55 2020 +0100

    appDisplay: Disconnect folder "changed" signal when actors are destroyed
    
    We should disconnect the folders "changed" signal from the folder in
    case the FolderView or FolderIcon is destroyed. While at it, also remove
    the unused this._spaceReadySignalId of FolderIcon.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011

 js/ui/appDisplay.js | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 042598ddcf..3d0bea97b3 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1324,10 +1324,20 @@ class FolderView extends BaseAppView {
         action.connect('pan', this._onPan.bind(this));
         this._scrollView.add_action(action);
 
-        this._folder.connect('changed', this._redisplay.bind(this));
+        this.connect('destroy', this._onDestroy.bind(this));
+
+        this._folderChangedId = this._folder.connect(
+            'changed', this._redisplay.bind(this));
         this._redisplay();
     }
 
+    _onDestroy() {
+        if (this._folderChangedId) {
+            this._folder.disconnect(this._folderChangedId);
+            delete this._folderChangedId;
+        }
+    }
+
     _childFocused(actor) {
         Util.ensureActorVisibleInScrollView(this._scrollView, actor);
     }
@@ -1515,7 +1525,8 @@ var FolderIcon = GObject.registerClass({
 
         this.connect('destroy', this._onDestroy.bind(this));
 
-        this._folder.connect('changed', this._sync.bind(this));
+        this._folderChangedId = this._folder.connect(
+            'changed', this._sync.bind(this));
         this._sync();
     }
 
@@ -1525,9 +1536,9 @@ var FolderIcon = GObject.registerClass({
 
         this.view.destroy();
 
-        if (this._spaceReadySignalId) {
-            this._parentView.disconnect(this._spaceReadySignalId);
-            this._spaceReadySignalId = 0;
+        if (this._folderChangedId) {
+            this._folder.disconnect(this._folderChangedId);
+            delete this._folderChangedId;
         }
 
         if (this._dialog)


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