[Telepathy-commits] [telepathy-gabble/master] Don't let stream die before getting initial codecs and candidates

Will Thompson will.thompson at collabora.co.uk
Thu Dec 11 08:04:53 PST 2008


Constructing a GabbleMediaStream adds an idle callback to extract information
from its JingleContent only once the creator of the MediaStream has had a
chance to connect to its signals.  If the refcount of the MediaStream fell to
zero before that callback fired, it would crash.  So, the callback should ref
the stream.
---
 src/media-stream.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/media-stream.c b/src/media-stream.c
index 56e3609..aea4ce5 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -186,6 +186,8 @@ _get_initial_codecs_and_candidates (gpointer user_data)
   new_remote_candidates_cb (priv->content,
       gabble_jingle_content_get_remote_candidates (priv->content), stream);
 
+  g_object_unref (stream);
+
   return FALSE;
 }
 
@@ -216,7 +218,7 @@ gabble_media_stream_constructor (GType type, guint n_props,
        * created, but we want to let it parse the initiation (if
        * initiated by remote end) before we pick up initial
        * codecs and candidates. */
-      g_idle_add (_get_initial_codecs_and_candidates, stream);
+      g_idle_add (_get_initial_codecs_and_candidates, g_object_ref (stream));
     }
 
   return obj;
-- 
1.5.6.5




More information about the Telepathy-commits mailing list