[next] telepathy-glib: TpAccount, TpConnection, TpChannel: assert that they are created through a factory

Xavier Claessens xclaesse at kemper.freedesktop.org
Fri Sep 7 10:05:55 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 0eac1fedda0a2666a0fb66e572f056de4683cafb
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=0eac1fedda0a2666a0fb66e572f056de4683cafb

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed Jul 11 13:20:13 2012 +0200

TpAccount, TpConnection, TpChannel: assert that they are created through a factory

---

 telepathy-glib/account.c    |    2 +-
 telepathy-glib/channel.c    |    3 +++
 telepathy-glib/connection.c |    3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index dc78086..55bcdb0 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -1036,7 +1036,7 @@ _tp_account_constructed (GObject *object)
 
   g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
 
-  _tp_proxy_ensure_factory (self, NULL);
+  g_assert (tp_proxy_get_factory (self) != NULL);
 
   sc = tp_cli_account_connect_to_removed (self, _tp_account_removed_cb,
       NULL, NULL, NULL, &error);
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index b0cd580..b9a48f2 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -905,6 +905,9 @@ tp_channel_constructor (GType type,
   GError *error = NULL;
   TpProxySignalConnection *sc;
 
+  g_assert (tp_proxy_get_factory (self) ==
+      tp_proxy_get_factory (self->priv->connection));
+
   /* If our TpConnection dies, so do we. */
   self->priv->conn_invalidated_id = g_signal_connect (self->priv->connection,
       "invalidated", G_CALLBACK (tp_channel_connection_invalidated_cb),
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index a80eda8..834fd87 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -1124,7 +1124,7 @@ tp_connection_constructed (GObject *object)
 
   DEBUG ("%s (%p) constructed", tp_proxy_get_object_path (object), object);
 
-  _tp_proxy_ensure_factory (self, NULL);
+  g_assert (tp_proxy_get_factory (self) != NULL);
 
   /* Connect to my own StatusChanged signal.
    * The connection hasn't had a chance to become invalid yet, so we can
@@ -2063,6 +2063,7 @@ _tp_connection_set_account (TpConnection *self,
 
   g_assert (self->priv->account == NULL);
   g_assert (account != NULL);
+  g_assert (tp_proxy_get_factory (self) == tp_proxy_get_factory (account));
 
   self->priv->account = account;
   g_object_add_weak_pointer ((GObject *) account,



More information about the telepathy-commits mailing list