diff options
Diffstat (limited to 'src/mcd-dispatch-operation.c')
-rw-r--r-- | src/mcd-dispatch-operation.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c index e8823a1a..04db4afe 100644 --- a/src/mcd-dispatch-operation.c +++ b/src/mcd-dispatch-operation.c @@ -514,6 +514,18 @@ _mcd_dispatch_operation_check_client_locks (McdDispatchOperation *self) return; } + /* If there are no potential handlers, the story ends here: we don't + * want to run approvers in this case */ + if (self->priv->possible_handlers == NULL) + { + GError incapable = { TP_ERRORS, TP_ERROR_NOT_CAPABLE, + "No possible handlers, giving up" }; + + DEBUG ("%s", incapable.message); + _mcd_dispatch_operation_close_as_undispatchable (self, &incapable); + return; + } + approval = g_queue_peek_head (self->priv->approvals); /* if we've been claimed, respond, then do not call HandleChannels */ @@ -1063,12 +1075,6 @@ mcd_dispatch_operation_constructor (GType type, guint n_params, if (!priv->client_registry || !priv->handler_map) goto error; - if (priv->possible_handlers == NULL && !priv->observe_only) - { - g_critical ("!observe_only => possible_handlers must not be NULL"); - goto error; - } - if (priv->needs_approval && priv->observe_only) { g_critical ("observe_only => needs_approval must not be TRUE"); @@ -1438,9 +1444,6 @@ _mcd_dispatch_operation_new (McdClientRegistry *client_registry, { 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); - /* If we're only observing, then the channels were requested "behind MC's * back", so they can't need approval (i.e. observe_only implies * !needs_approval) */ @@ -1812,8 +1815,13 @@ _mcd_dispatch_operation_handlers_can_bypass_approval ( if (_mcd_dispatch_operation_is_internal (self)) return TRUE; + /* special case: we don't have any handlers at all, so we don't want + * approval - we're just going to fail */ + if (self->priv->possible_handlers == NULL) + return TRUE; + for (iter = self->priv->possible_handlers; - iter != NULL && *iter != NULL; + *iter != NULL; iter++) { McdClientProxy *handler = _mcd_client_registry_lookup ( |