aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-07 18:24:22 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-07 19:00:13 +0800
commit52bb570645883d3920f4950aa1dca8f6d88b4b32 (patch)
tree46d3a93bd9215ce920dbdbc462af4d516a8987a6 /libempathy
parent63b5db096a4a8e706bf9d2b7043aa6c9fe5d5697 (diff)
downloadgsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar.gz
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar.bz2
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar.lz
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar.xz
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.tar.zst
gsoc2013-empathy-52bb570645883d3920f4950aa1dca8f6d88b4b32.zip
dispatch-operation: fix a race by waiting that TpCall is ready
The call handler constructor rely on the TpCall to be ready (to fetch the EmpathyContact associated with the call). If things are going fast (by skipping the approving of the call and handling it right away for example) it may no be ready yet.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-dispatch-operation.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 68143c55b..78438125b 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -458,6 +458,17 @@ empathy_dispatcher_operation_tp_chat_ready_cb (GObject *object,
}
static void
+call_status_changed_cb (EmpathyTpCall *call,
+ GParamSpec *spec,
+ EmpathyDispatchOperation *self)
+{
+ if (empathy_tp_call_get_status (call) <= EMPATHY_TP_CALL_STATUS_READYING)
+ return;
+
+ channel_wrapper_ready (self);
+}
+
+static void
empathy_dispatch_operation_channel_ready_cb (TpChannel *channel,
const GError *error, gpointer user_data)
{
@@ -495,8 +506,22 @@ empathy_dispatch_operation_channel_ready_cb (TpChannel *channel,
}
else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
{
+ gboolean requested;
EmpathyTpCall *call = empathy_tp_call_new (channel);
priv->channel_wrapper = G_OBJECT (call);
+
+ requested = tp_asv_get_boolean (tp_channel_borrow_immutable_properties (
+ channel), TP_PROP_CHANNEL_REQUESTED, NULL);
+
+ if (!requested &&
+ empathy_tp_call_get_status (call) <= EMPATHY_TP_CALL_STATUS_READYING)
+ {
+ /* For incoming calls, we have to wait that the TpCall is ready as
+ * the call-handler rely on it. */
+ priv->ready_handler = g_signal_connect (call,
+ "notify::status", G_CALLBACK (call_status_changed_cb), self);
+ goto out;
+ }
}
else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER)
{