[polari] Disconnect account signal handlers



commit 5217aefc8eb55361b836d667d44837ab95321ccb
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Sep 22 10:38:53 2014 +0200

    Disconnect account signal handlers
    
    The account object outlives the widgets in these cases, so we
    need to disconnect.

 src/appNotifications.js |    8 ++++++--
 src/connections.js      |    6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 385ba8f..694c422 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -108,8 +108,12 @@ const ConnectingNotification = new Lang.Class({
         this.widget.add(this._grid);
         this.widget.show_all();
 
-        account.connect('notify::connection-status',
-                        Lang.bind(this, this._onConnectionStatusChanged));
+        let id = account.connect('notify::connection-status',
+                                 Lang.bind(this, this._onConnectionStatusChanged));
+        this.widget.connect('destroy',
+            function() {
+                account.disconnect(id);
+            });
     },
 
     _onConnectionStatusChanged: function(account) {
diff --git a/src/connections.js b/src/connections.js
index 64650cb..e361ed3 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -94,10 +94,14 @@ const ConnectionsDialog = new Lang.Class({
                               GObject.BindingFlags.SYNC_CREATE);
         account.bind_property('enabled', sw, 'state',
                               GObject.BindingFlags.SYNC_CREATE);
-        account.connect('notify::display-name',
+        let id = account.connect('notify::display-name',
             function() {
                 row.changed();
             });
+        row.connect('destroy',
+            function() {
+                account.disconnect(id);
+            });
 
         sw.connect('state-set',
             function(w, state) {


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