summaryrefslogtreecommitdiff
path: root/telepathy-glib/channel.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-12-09 16:55:18 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-12-09 16:55:18 +0000
commit11928fcc640d09e55e3f6f8251716efd73187edd (patch)
tree4edb36ad190c7418c8fbe3d9aaa5c62b140abf99 /telepathy-glib/channel.c
parent34d4788bcaa0ebb70157a0556df9456b388ac568 (diff)
downloadtelepathy-glib-11928fcc640d09e55e3f6f8251716efd73187edd.tar.gz
channel_close_cb: complete in an idle
tp_cli callbacks don't guarantee not to call the callback re-entrantly: if the interface is absent, or the proxy has been invalidated, they'll call the callback before returning. Sad times. Also document why channel_remove_self_cb doesn't have to do this: it's only called after preparing the GROUP feature, which does guarantee to be idle.
Diffstat (limited to 'telepathy-glib/channel.c')
-rw-r--r--telepathy-glib/channel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index 1e11380c6..202e714cd 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -2124,6 +2124,8 @@ tp_channel_get_initiator_identifier (TpChannel *self)
return id != NULL ? id : "";
}
+/* tp_cli callbacks can potentially be called in a re-entrant way,
+ * so we can't necessarily complete @result without using an idle. */
static void
channel_close_cb (TpChannel *channel,
const GError *error,
@@ -2146,10 +2148,13 @@ channel_close_cb (TpChannel *channel,
}
}
- g_simple_async_result_complete (result);
+ g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
}
+/* This is only called from the main loop, as a result of group_prepared_cb
+ * having the same property, so it can complete LeaveCtx.result without
+ * an idle. */
static void
channel_remove_self_cb (TpChannel *channel,
const GError *error,
@@ -2214,6 +2219,8 @@ leave_ctx_free (LeaveCtx *ctx)
g_slice_free (LeaveCtx, ctx);
}
+/* This is only called from the main loop, so it can safely complete
+ * LeaveCtx.result without an idle. */
static void
group_prepared_cb (GObject *source,
GAsyncResult *res,