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:22:50 +0100
commit06d98c31504139136336160aac4b1f094a8ccc88 (patch)
tree0f05c8e1ab6f7eac0e1f70b28274c65ff84aa6b9
parentf1ece52985d24d734462f96e8a33db8ced771fdb (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
{