[gnome-shell] iconGrid: Disconnect signals on destroy



commit 30e49cc3ca2c6cea07ace149eb7448f48dbb5d36
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 8 20:36:14 2021 +0200

    iconGrid: Disconnect signals on destroy
    
    Otherwise the handler will trip over unset properties on an object
    that is being disposed. Avoid the resulting log spam by disconnecting
    the handler in question.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1909>

 js/ui/iconGrid.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index cdceb020df..efc638913e 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -1172,7 +1172,8 @@ var IconGrid = GObject.registerClass({
             row_spacing: 0,
         });
         const layoutManager = new IconGridLayout(layoutParams);
-        layoutManager.connect('pages-changed', () => this.emit('pages-changed'));
+        const pagesChangedId = layoutManager.connect('pages-changed',
+            () => this.emit('pages-changed'));
 
         super._init({
             style_class: 'icon-grid',
@@ -1188,6 +1189,7 @@ var IconGrid = GObject.registerClass({
 
         this.connect('actor-added', this._childAdded.bind(this));
         this.connect('actor-removed', this._childRemoved.bind(this));
+        this.connect('destroy', () => layoutManager.disconnect(pagesChangedId));
     }
 
     _getChildrenToAnimate() {


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