[gnome-shell] keyboard: Make sure to destroy the key's BoxPointer



commit 9d933356e171a1dc49b61b5864826531c0f24d97
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Sep 19 18:44:45 2014 -0600

    keyboard: Make sure to destroy the key's BoxPointer
    
    When the keyboard is destroyed, we destroy the keyboard actor, but the
    keyboard's menu isn't part of the key itself, so it's never tracked.
    
    The menus are actually tracked actors, so they slow down the layout
    manager's code to rebuild regions and other things. Keeping this list
    small is a good idea.
    
    To prevent leaking menus, destroy the menu when the key is destroyed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736999

 js/ui/keyboard.js |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index d2a8dd5..b3de70b 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -75,6 +75,7 @@ const Key = new Lang.Class({
     _init : function(key) {
         this._key = key;
         this.actor = this._makeKey(key, GLib.markup_escape_text(key.label, -1));
+        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
 
         this._extended_keys = this._key.get_extended_keys();
         this._extended_keyboard = null;
@@ -97,6 +98,13 @@ const Key = new Lang.Class({
         }
     },
 
+    _onDestroy: function() {
+        if (this._boxPointer) {
+            this._boxPointer.actor.destroy();
+            this._boxPointer = null;
+        }
+    },
+
     _makeKey: function (key, label) {
         let button = new St.Button ({ label: label,
                                       style_class: 'keyboard-key' });


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