[Telepathy-commits] [telepathy-gabble/master] Ref initial peer's handle in media channels

Will Thompson will.thompson at collabora.co.uk
Wed Feb 4 07:33:00 PST 2009


Previously, if you requested a media using CreateChannel and TargetID,
the handle would actually fall out of scope as soon as CreateChannel
returned, and incoherence would ensue.
---
 src/media-channel.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index 8fb78fc..0e5fd4c 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -505,6 +505,15 @@ gabble_media_channel_set_property (GObject     *object,
       break;
     case PROP_INITIAL_PEER:
       priv->initial_peer = g_value_get_uint (value);
+
+      if (priv->initial_peer != 0)
+        {
+          TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn;
+          TpHandleRepoIface *repo = tp_base_connection_get_handles (base_conn,
+              TP_HANDLE_TYPE_CONTACT);
+          tp_handle_ref (repo, priv->initial_peer);
+        }
+
       break;
     case PROP_SESSION:
       g_assert (priv->session == NULL);
@@ -721,6 +730,12 @@ gabble_media_channel_dispose (GObject *object)
   tp_handle_unref (contact_handles, priv->creator);
   priv->creator = 0;
 
+  if (priv->initial_peer != 0)
+    {
+      tp_handle_unref (contact_handles, priv->initial_peer);
+      priv->initial_peer = 0;
+    }
+
   /** In this we set the state to ENDED, then the callback unrefs
    * the session
    */
-- 
1.5.6.5



More information about the telepathy-commits mailing list