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



commit cb6e44e42b85a0b310fc741af85bc624d79e6160
Author: Ray Strode <rstrode redhat com>
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).
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628

 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]