[folks] Properly disconnect the logger::invalidated handler.



commit 09bf32c22843eaa9cf34bd091d864dfa85bf4d63
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue Jun 21 16:14:04 2011 -0700

    Properly disconnect the logger::invalidated handler.
    
    Helps: bgo#629716 - Migrate Folks to GDBus

 backends/telepathy/lib/tpf-persona-store.vala |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index ea57b06..4b18ebd 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -202,6 +202,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
     {
       this._debug.print_status.disconnect (this._debug_print_status);
       this._debug = null;
+      if (this._logger != null)
+        this._logger.invalidated.disconnect (this._logger_invalidated_cb);
     }
 
   private string _format_maybe_bool (MaybeBool input)
@@ -535,12 +537,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
                 {
                   this._logger = new Logger (this.id);
                   yield this._logger.prepare ();
-                  this._logger.invalidated.connect (() =>
-                    {
-                      warning (
-                          _("Lost connection to the telepathy-logger service."));
-                      this._logger = null;
-                    });
+                  this._logger.invalidated.connect (
+                      this._logger_invalidated_cb);
                   this._logger.favourite_contacts_changed.connect (
                       this._favourite_contacts_changed_cb);
                 }
@@ -557,6 +555,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
         }
     }
 
+  private void _logger_invalidated_cb ()
+    {
+      this._logger.invalidated.disconnect (this._logger_invalidated_cb);
+
+      warning (_("Lost connection to the telepathy-logger service."));
+      this._logger = null;
+    }
+
   private async void _initialise_favourite_contacts ()
     {
       if (this._logger == null)



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