[gnome-shell/wip/appdisplay-leak: 2/2] appDisplay: ensure FolderView gets destroyed with its icon



commit 55984deef96c7e24985fe4a9b373a21bb73aeedf
Author: rpm-build <rpm-build>
Date:   Mon Jul 15 15:48:05 2019 -0400

    appDisplay: ensure FolderView gets destroyed with its icon
    
    Every FolderIcon has a FolderView associated with it.
    
    When the FolderIcon gets destroyed the folder view should
    get destroyed, too, but currently doesn't always.
    
    This commit ensures the view gets destroyed with the icon,
    by adding a destroy handler to the FolderIcon class that
    clears the reference to its folder view (and if necessary
    the popup, too).

 js/ui/appDisplay.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 258add8fd..8768ca8f9 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1122,6 +1122,7 @@ var FolderIcon = class FolderIcon {
 
         this.view = new FolderView();
 
+        this.actor.connect('destroy', () => this._onDestroy.bind(this));
         this.actor.connect('clicked', () => {
             this._ensurePopup();
             this.view.actor.vscroll.adjustment.value = 0;
@@ -1136,6 +1137,11 @@ var FolderIcon = class FolderIcon {
         this._redisplay();
     }
 
+    _onDestroy() {
+        this._popup = null;
+        this.view = null;
+    }
+
     getAppIds() {
         return this.view.getAllItems().map(item => item.id);
     }


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