[telepathy-mission-control/master] Tighten assertions about how observe_only, needs_approval and possible_handlers relate
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 2 06:56:29 PST 2009
---
src/mcd-dispatch-operation.c | 7 +++++++
src/mcd-dispatcher.c | 6 +++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index aa0dab3..4e2d05c 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -983,6 +983,13 @@ _mcd_dispatch_operation_new (McdClientRegistry *client_registry,
const gchar * const *possible_handlers)
{
gpointer *obj;
+
+ /* possible-handlers is only allowed to be NULL if we're only observing */
+ g_return_val_if_fail (possible_handlers != NULL || observe_only, NULL);
+ /* channels that we will only observe should not need approval - so at
+ * least one must be false */
+ g_return_val_if_fail (!(observe_only && needs_approval), NULL);
+
obj = g_object_new (MCD_TYPE_DISPATCH_OPERATION,
"client-registry", client_registry,
"handler-map", handler_map,
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 2f16e76..191b3bb 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -546,6 +546,8 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
g_return_if_fail (MCD_IS_DISPATCHER (dispatcher));
g_return_if_fail (channels != NULL);
g_return_if_fail (MCD_IS_CHANNEL (channels->data));
+ g_return_if_fail (requested || !only_observe);
+ g_return_if_fail (possible_handlers != NULL || only_observe);
account = mcd_channel_get_account (channels->data);
if (G_UNLIKELY (!account))
@@ -1625,10 +1627,12 @@ _mcd_dispatcher_take_channels (McdDispatcher *dispatcher, GList *channels,
if (only_observe)
{
+ g_return_if_fail (requested);
+
/* these channels were requested "behind our back", so only call
* ObserveChannels on them */
_mcd_dispatcher_enter_state_machine (dispatcher, channels, NULL,
- requested, TRUE);
+ TRUE, TRUE);
g_list_free (channels);
return;
}
--
1.5.6.5
More information about the telepathy-commits
mailing list