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



commit ea978b8cadf6e4f458fa69e9f305c2fdd12aac9b
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.

 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]