[gnome-shell/gbsneto/disconnect-parental-controls] appDisplay: Disconnect from parental controls on destroy




commit 1d9bbfc598652b491ce7ebba6f4480e32c65091b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Sep 16 14:44:49 2020 -0300

    appDisplay: Disconnect from parental controls on destroy
    
    Icons not disconnecting means parental controls may trigger
    callbacks on destroyed a destroyed grid, which tries to access
    destroyed icons, which spams the journal with stack traces.
    
    Disconnect from parental controls when BaseAppView is destroyed.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1441

 js/ui/appDisplay.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 68fdbdd0e7..f9e6a9b7da 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -188,9 +188,10 @@ var BaseAppView = GObject.registerClass({
 
         // Filter the apps through the user’s parental controls.
         this._parentalControlsManager = ParentalControlsManager.getDefault();
-        this._parentalControlsManager.connect('app-filter-changed', () => {
-            this._redisplay();
-        });
+        this._appFilterChangedId =
+            this._parentalControlsManager.connect('app-filter-changed', () => {
+                this._redisplay();
+            });
 
         // Drag n' Drop
         this._lastOvershoot = -1;
@@ -206,6 +207,10 @@ var BaseAppView = GObject.registerClass({
     }
 
     _onDestroy() {
+        if (this._appFilterChangedId > 0) {
+            this._parentalControlsManager.disconnect(this._appFilterChangedId);
+            this._appFilterChangedId = 0;
+        }
         this._removeDelayedMove();
         this._disconnectDnD();
     }


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