telepathy-rakia: Stop refcounting handles

Simon McVittie smcv at kemper.freedesktop.org
Thu May 10 05:40:11 PDT 2012


Module: telepathy-rakia
Branch: master
Commit: b0d9f44e34d9a86efa80ad1d51551a08273437f8
URL:    http://cgit.freedesktop.org/telepathy/telepathy-rakia/commit/?id=b0d9f44e34d9a86efa80ad1d51551a08273437f8

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu May 10 13:31:37 2012 +0100

Stop refcounting handles

They've been "immortal" since before telepathy-glib 0.14.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49732
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 rakia/handles.c       |    9 +--------
 rakia/handles.h       |    5 ++++-
 rakia/media-manager.c |    3 ---
 rakia/text-channel.c  |   41 ++++++-----------------------------------
 rakia/text-manager.c  |    2 --
 5 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/rakia/handles.c b/rakia/handles.c
index 25b77b2..baa4812 100644
--- a/rakia/handles.c
+++ b/rakia/handles.c
@@ -116,14 +116,7 @@ void
 rakia_handle_unref (TpBaseConnection *conn,
                     TpHandle handle)
 {
-  TpHandleRepoIface *repo;
-
-  g_return_if_fail (TP_IS_BASE_CONNECTION (conn));
-  g_return_if_fail (handle != 0);
-
-  repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT);
-
-  tp_handle_unref (repo, handle);
+  /* no longer useful */
 }
 
 char const *
diff --git a/rakia/handles.h b/rakia/handles.h
index c18f3fa..ac9d2e7 100644
--- a/rakia/handles.h
+++ b/rakia/handles.h
@@ -28,7 +28,6 @@ G_BEGIN_DECLS
 
 TpHandle rakia_handle_ensure (TpBaseConnection *, url_t const *, char const *);
 TpHandle rakia_handle_by_requestor (TpBaseConnection *, sip_t const *sip);
-void rakia_handle_unref (TpBaseConnection *, TpHandle handle);
 char const *rakia_handle_inspect (TpBaseConnection *, TpHandle handle);
 const url_t *rakia_handle_inspect_uri (TpBaseConnection *, TpHandle handle);
 
@@ -42,6 +41,10 @@ gchar *rakia_normalize_contact (const gchar *sipuri,
     const gchar *transport,
     GError **error);
 
+/* no longer does anything */
+G_DEPRECATED
+void rakia_handle_unref (TpBaseConnection *, TpHandle handle);
+
 G_END_DECLS
 
 #endif /* !RAKIA_HANDLE_H */
diff --git a/rakia/media-manager.c b/rakia/media-manager.c
index b5b1382..7b996e0 100644
--- a/rakia/media-manager.c
+++ b/rakia/media-manager.c
@@ -381,8 +381,6 @@ incoming_call_cb (RakiaSipSession *session,
     struct InviteData *idata)
 {
   RakiaCallChannel *channel;
-  RakiaMediaManagerPrivate *priv =
-      RAKIA_MEDIA_MANAGER_GET_PRIVATE (idata->fac);
 
   g_signal_handlers_disconnect_by_func (session,
       G_CALLBACK (incoming_call_cb), idata);
@@ -394,7 +392,6 @@ incoming_call_cb (RakiaSipSession *session,
       TP_EXPORTABLE_CHANNEL (channel), NULL);
 
   g_object_unref (session);
-  rakia_handle_unref (priv->conn, idata->handle);
   g_slice_free (struct InviteData, idata);
 }
 
diff --git a/rakia/text-channel.c b/rakia/text-channel.c
index a75027f..4393d68 100644
--- a/rakia/text-channel.c
+++ b/rakia/text-channel.c
@@ -131,8 +131,8 @@ struct _RakiaTextChannelPrivate
 
 #define RAKIA_TEXT_CHANNEL_GET_PRIVATE(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), RAKIA_TYPE_TEXT_CHANNEL, RakiaTextChannelPrivate))
 
-static void rakia_text_pending_free (RakiaTextPendingMessage *msg,
-                                     TpHandleRepoIface *contact_handles)
+static void
+rakia_text_pending_free (RakiaTextPendingMessage *msg)
 {
   if (msg->nh)
     nua_handle_unref (msg->nh);
@@ -161,7 +161,6 @@ rakia_text_channel_constructed (GObject *obj)
 {
   RakiaTextChannelPrivate *priv;
   TpBaseConnection *base_conn;
-  TpHandleRepoIface *contact_handles;
   TpDBusDaemon *bus;
   TpChannelTextMessageType types[] = {
       TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
@@ -178,13 +177,8 @@ rakia_text_channel_constructed (GObject *obj)
 
   priv = RAKIA_TEXT_CHANNEL_GET_PRIVATE(RAKIA_TEXT_CHANNEL(obj));
   base_conn = (TpBaseConnection *) priv->conn;
-  contact_handles = tp_base_connection_get_handles (base_conn,
-      TP_HANDLE_TYPE_CONTACT);
-
-  tp_handle_ref (contact_handles, priv->handle);
 
   g_assert (priv->initiator != 0);
-  tp_handle_ref (contact_handles, priv->initiator);
 
   rakia_base_connection_add_auth_handler (priv->conn, RAKIA_EVENT_TARGET (obj));
 
@@ -452,7 +446,6 @@ rakia_text_channel_dispose(GObject *object)
 {
   RakiaTextChannel *self = RAKIA_TEXT_CHANNEL (object);
   RakiaTextChannelPrivate *priv = RAKIA_TEXT_CHANNEL_GET_PRIVATE (self);
-  TpHandleRepoIface *contact_handles;
 
   if (priv->dispose_has_run)
     return;
@@ -465,24 +458,15 @@ rakia_text_channel_dispose(GObject *object)
       tp_svc_channel_emit_closed (self);
     }
 
-  contact_handles = tp_base_connection_get_handles (
-      (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
-
-  tp_handle_unref (contact_handles, priv->handle);
-
-  if (priv->initiator != 0)
-    tp_handle_unref (contact_handles, priv->initiator);
-
   if (G_OBJECT_CLASS (rakia_text_channel_parent_class)->dispose)
     G_OBJECT_CLASS (rakia_text_channel_parent_class)->dispose (object);
 }
 
 static void
-zap_pending_messages (GQueue *pending_messages,
-                      TpHandleRepoIface *contact_handles)
+zap_pending_messages (GQueue *pending_messages)
 {
   g_queue_foreach (pending_messages,
-      (GFunc) rakia_text_pending_free, contact_handles);
+      (GFunc) rakia_text_pending_free, NULL);
   g_queue_clear (pending_messages);
 }
 
@@ -491,14 +475,10 @@ rakia_text_channel_finalize(GObject *object)
 {
   RakiaTextChannel *self = RAKIA_TEXT_CHANNEL (object);
   RakiaTextChannelPrivate *priv = RAKIA_TEXT_CHANNEL_GET_PRIVATE (self);
-  TpHandleRepoIface *contact_handles;
-
-  contact_handles = tp_base_connection_get_handles (
-      (TpBaseConnection *)priv->conn, TP_HANDLE_TYPE_CONTACT);
 
   DEBUG ("%u pending outgoing message requests",
       g_queue_get_length (priv->sending_messages));
-  zap_pending_messages (priv->sending_messages, contact_handles);
+  zap_pending_messages (priv->sending_messages);
   g_queue_free (priv->sending_messages);
 
   g_free (priv->object_path);
@@ -548,15 +528,10 @@ rakia_text_channel_close (TpSvcChannel *iface,
 
           if (priv->initiator != priv->handle)
             {
-              TpHandleRepoIface *contact_repo = tp_base_connection_get_handles
-                  ((TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
-
               g_assert (priv->initiator != 0);
               g_assert (priv->handle != 0);
 
-              tp_handle_unref (contact_repo, priv->initiator);
               priv->initiator = priv->handle;
-              tp_handle_ref (contact_repo, priv->initiator);
             }
         }
       tp_svc_channel_emit_closed (self);
@@ -792,7 +767,6 @@ rakia_text_channel_nua_r_message_cb (RakiaTextChannel *self,
 {
   RakiaTextChannelPrivate *priv = RAKIA_TEXT_CHANNEL_GET_PRIVATE (self);
   RakiaTextPendingMessage *msg;
-  TpHandleRepoIface *contact_repo;
   TpChannelTextSendError send_error;
   GList *node;
 
@@ -870,10 +844,7 @@ rakia_text_channel_nua_r_message_cb (RakiaTextChannel *self,
 
   g_queue_remove(priv->sending_messages, msg);
 
-  contact_repo = tp_base_connection_get_handles (
-      (TpBaseConnection *)(priv->conn), TP_HANDLE_TYPE_CONTACT);
-
-  rakia_text_pending_free(msg, contact_repo);
+  rakia_text_pending_free (msg);
 
   return TRUE;
 }
diff --git a/rakia/text-manager.c b/rakia/text-manager.c
index 37d48a4..12d88f5 100644
--- a/rakia/text-manager.c
+++ b/rakia/text-manager.c
@@ -587,8 +587,6 @@ rakia_nua_i_message_cb (TpBaseConnection    *conn,
   rakia_text_channel_receive (channel,
       sip, handle, text, len);
 
-  rakia_handle_unref (conn, handle);
-
 end:
   g_free (allocated_text);
 



More information about the telepathy-commits mailing list