[gnome-shell/wip/appdisplay-leak: 1/2] appDisplay: ensure duplicate items get destroyed from AppView



commit 6d406ee811ccd5ed7bea24366e7c06d47cf24488
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jul 15 13:52:58 2019 -0400

    appDisplay: ensure duplicate items get destroyed from AppView
    
    If an icon already exists in an app view with the same id, the
    duplicate is not added on a call to addItem.  Unfortunately,
    since it's not added, the icon actor gets orphaned and leaked.
    
    This commit address the problem by explicitly destroying the icon
    from addItem if the AppView decides its a duplicate that shouldn't
    get added.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628

 js/ui/appDisplay.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 60322f81a..c4bac3749 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -130,8 +130,10 @@ class BaseAppView {
 
     addItem(icon) {
         let id = icon.id;
-        if (this._items[id] !== undefined)
+        if (this._items[id] !== undefined) {
+            icon.actor.destroy();
             return;
+        }
 
         this._allItems.push(icon);
         this._items[id] = icon;


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