[gnome-shell/wip/rstrode/login-screen-extensions: 30/134] shellEntry: Disconnect handler on destroy




commit 4fd2298b3969bf6354f2a628b1b1726b587f096b
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jun 14 17:59:39 2021 +0200

    shellEntry: Disconnect handler on destroy
    
    Actors will get unmapped on destroy, so unless we disconnect from
    the notify::mapped signal, the handler will run one last time and
    try to access methods/properties on the invalidated actor.

 js/ui/shellEntry.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 4a30b22f7a..53bd1daa1d 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -186,7 +186,7 @@ class CapsLockWarning extends St.Label {
         this._keymap = Clutter.get_default_backend().get_keymap();
         this._stateChangedId = 0;
 
-        this.connect('notify::mapped', () => {
+        const mappedId = this.connect('notify::mapped', () => {
             if (this.is_mapped()) {
                 this._stateChangedId = this._keymap.connect('state-changed',
                     () => this._sync(true));
@@ -201,6 +201,7 @@ class CapsLockWarning extends St.Label {
         this.connect('destroy', () => {
             if (this._stateChangedId)
                 this._keymap.disconnect(this._stateChangedId);
+            this.disconnect(mappedId);
         });
     }
 


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