From 06d98c31504139136336160aac4b1f094a8ccc88 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 20 Sep 2011 15:58:37 +0100 Subject: [PATCH] Call: handle google relay reply after channel dies Previously, if the Google relay server replied to our HTTP request after the Call channel had already gone away, we'd crash. Fixes: --- src/call-stream.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/call-stream.c b/src/call-stream.c index 1e0bc00..147d818 100644 --- a/src/call-stream.c +++ b/src/call-stream.c @@ -176,9 +176,17 @@ static void google_relay_session_cb (GPtrArray *relays, gpointer user_data) { - TpyBaseMediaCallStream *stream = TPY_BASE_MEDIA_CALL_STREAM (user_data); + TpWeakRef *weak_ref = user_data; + TpyBaseMediaCallStream *stream = TPY_BASE_MEDIA_CALL_STREAM ( + tp_weak_ref_dup_object (weak_ref)); - tpy_base_media_call_stream_set_relay_info (stream, relays); + if (stream != NULL) + { + tpy_base_media_call_stream_set_relay_info (stream, relays); + g_object_unref (stream); + } + + tp_weak_ref_destroy (weak_ref); } static void @@ -343,7 +351,7 @@ gabble_call_stream_constructed (GObject *obj) * We ask for enough relays for 2 components (RTP and RTCP) since we * don't yet know whether there will be RTCP. */ gabble_jingle_factory_create_google_relay_session (conn->jingle_factory, - 2, google_relay_session_cb, obj); + 2, google_relay_session_cb, tp_weak_ref_new (self, NULL, NULL)); } else { -- 1.7.5.4