[polari/wip/fmuellner/invalid-object-access: 2/8] connections: Disconnect account signals



commit b666281150373406e0e176f5eecd0879a4b51087
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Dec 6 01:20:44 2017 +0100

    connections: Disconnect account signals
    
    Accounts clearly have a longer life time than the dialog, so we need
    to disconnect any handlers to not leak the signal connection.

 src/connections.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/connections.js b/src/connections.js
index aecbdd5..5d04388 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -498,9 +498,11 @@ var ConnectionProperties = GObject.registerClass({
         });
         this.set_default_response(Gtk.ResponseType.OK);
 
-        account.connect('notify::connection-status',
-                        this._syncErrorMessage.bind(this));
+        let id = account.connect('notify::connection-status',
+                                 this._syncErrorMessage.bind(this));
         this._syncErrorMessage(account);
+
+        this.connect('destroy', () => { account.disconnect(id); });
     }
 
     _syncErrorMessage(account) {


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