[gnome-shell/wip/carlosg/destroy-old-osk-layouts] keyboard: Destroy old layout actors when regenerating keyboard groups



commit 0e7479e93ef7f3b450a08d6cdea1cfd065ce20ae
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Apr 30 14:08:25 2019 +0200

    keyboard: Destroy old layout actors when regenerating keyboard groups
    
    We were cleaning up self._groups, but the actors for all previous
    groups/layers/modes would remain attached to the aspect container,
    simply hidden.
    
    Under some circumstances this can really make the amount of actors
    in the shell stage to quickly ramp up, it's not just a "leak" but
    also has potential side effects on performance.
    
    We should destroy all child actors of this._aspectContainer, except
    the static ones (emoji and keypad).
    
    Closes?: https://gitlab.gnome.org/GNOME/mutter/issues/556

 js/ui/keyboard.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 71ebd5596..652b5c331 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1472,6 +1472,16 @@ var Keyboard = class Keyboard {
     }
 
     _onKeyboardGroupsChanged(keyboard) {
+        for (let child = this._aspectContainer.get_first_child();
+             child != null;
+             child = child.get_next_sibling()) {
+            if (child == this._emojiSelection.actor ||
+                child == this._keypad.actor)
+                continue;
+
+            child.destroy();
+        }
+
         this._groups = [];
         this._onGroupChanged();
     }


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