summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-20 15:58:37 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-09-20 16:47:05 +0100
commitc84617178fd951ece907cec4eb5c1da44c2123bb (patch)
treebbf29007ea1f3a22fccca960efad43904a8e4682
parent97175d86d43f0d9ebe7fa3f3f0ed96e825ae8094 (diff)
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: <http://bugs.freedesktop.org/show_bug.cgi?id=39768>
-rw-r--r--src/call-stream.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/call-stream.c b/src/call-stream.c
index 1e0bc005..147d818d 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
{