[gnome-shell/gnome-3-38] iconGrid: Disconnect signals on destroy



commit fc0a87e8a587f4f407634e7c3cef901b0eefe46b
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>
    (cherry picked from commit 30e49cc3ca2c6cea07ace149eb7448f48dbb5d36)

 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 da33eb6536..e41d4f6270 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -1311,7 +1311,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',
@@ -1327,6 +1328,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]