[telepathy-gabble/master] Fix some JingleContent reference leaks.

Will Thompson will.thompson at collabora.co.uk
Wed Apr 29 07:56:50 PDT 2009


g_object_get()-ing refs the returned object. I decided it was cleaner to
use gabble_media_stream_get_content() (which doesn't ref the content)
anyway.
---
 src/media-channel.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index d4383b4..eedfd03 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -1174,15 +1174,18 @@ gabble_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface,
   /* groovy, it's all good dude, let's remove them */
   if (stream_objs->len > 0)
     {
-      GabbleJingleContent *c;
+      GabbleMediaStream *stream;
+      GabbleJingleMediaRtp *c;
 
       for (i = 0; i < stream_objs->len; i++)
         {
-          g_object_get (g_ptr_array_index (stream_objs, i), "content", &c, NULL);
+          stream = g_ptr_array_index (stream_objs, i);
+          c = gabble_media_stream_get_content (stream);
 
           /* FIXME: make sure session emits content-removed, on which we can
            * delete it from the list */
-          gabble_jingle_session_remove_content (priv->session, c);
+          gabble_jingle_session_remove_content (priv->session,
+              (GabbleJingleContent *) c);
         }
     }
 
@@ -1248,12 +1251,13 @@ gabble_media_channel_request_stream_direction (TpSvcChannelTypeStreamedMedia *if
 
   if (stream_direction == TP_MEDIA_STREAM_DIRECTION_NONE)
     {
-      GabbleJingleContent *c;
+      GabbleJingleMediaRtp *c;
 
       DEBUG ("request for NONE direction; removing stream");
 
-      g_object_get (stream, "content", &c, NULL);
-      gabble_jingle_session_remove_content (priv->session, c);
+      c = gabble_media_stream_get_content (stream);
+      gabble_jingle_session_remove_content (priv->session,
+          (GabbleJingleContent *) c);
 
       tp_svc_channel_type_streamed_media_return_from_request_stream_direction (
           context);
@@ -2331,17 +2335,20 @@ stream_error_cb (GabbleMediaStream *stream,
                  GabbleMediaChannel *chan)
 {
   GabbleMediaChannelPrivate *priv = chan->priv;
-  GabbleJingleContent *c;
+  GabbleJingleMediaRtp *c;
   guint id;
 
   /* emit signal */
-  g_object_get (stream, "id", &id, "content", &c, NULL);
+  g_object_get (stream, "id", &id, NULL);
   tp_svc_channel_type_streamed_media_emit_stream_error (chan, id, errno,
       message);
 
   /* remove stream from session (removal will be signalled
-   * so we can dispose of the stream) */
-  gabble_jingle_session_remove_content (priv->session, c);
+   * so we can dispose of the stream)
+   */
+  c = gabble_media_stream_get_content (stream);
+  gabble_jingle_session_remove_content (priv->session,
+      (GabbleJingleContent *) c);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list