[next] telepathy-gabble: GabbleRoster: set priv->conn before chaining up

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:41 PDT 2014


Module: telepathy-gabble
Branch: next
Commit: 9d298ba6b67ea515cc1b2dfa201e8f89671b87cb
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=9d298ba6b67ea515cc1b2dfa201e8f89671b87cb

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr 22 12:50:04 2014 +0100

GabbleRoster: set priv->conn before chaining up

The parent constructed() callback calls can_block(), and our
implementation of can_block() needs the connection, so we need to
do that first.

---

 src/roster.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/roster.c b/src/roster.c
index ed4cb11..87f0610 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -1865,19 +1865,21 @@ gabble_roster_constructed (GObject *obj)
     ((GObjectClass *) gabble_roster_parent_class)->constructed;
   TpHandleRepoIface *contact_repo;
 
-  if (chain_up != NULL)
-    chain_up (obj);
-
   /* FIXME: This is not a strong reference because that would create a cycle.
    * I'd like to have a cyclic reference and break it at disconnect time,
    * like the contact list example in telepathy-glib does, but we can't do
    * that because the rest of Gabble assumes that the roster remains useful
    * until the bitter end (for instance, gabble_im_channel_dispose looks
-   * at the contact's subscription). */
+   * at the contact's subscription).
+   *
+   * Set this before chaining up, so can_block() can use it. */
   self->priv->conn = GABBLE_CONNECTION (tp_base_contact_list_get_connection (
         base, NULL));
   g_assert (GABBLE_IS_CONNECTION (self->priv->conn));
 
+  if (chain_up != NULL)
+    chain_up (obj);
+
   contact_repo = tp_base_connection_get_handles (
       (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT);
 



More information about the telepathy-commits mailing list