[telepathy-mission-control/master] McdDispatcherContext: always release all client locks, and use a separate flag to suppress handlers
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Sep 8 09:14:18 PDT 2009
This makes the handling of CTXREF14 more obviously correct.
---
src/mcd-dispatcher.c | 39 +++++++++++++++++----------------------
1 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index d1e7275..998d696 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -110,6 +110,10 @@ struct _McdDispatcherContext
* lock is active. */
guint invoking_clients : 1;
+ /* If TRUE, either we've already arranged for the channels to get a
+ * handler, or there are no channels left. */
+ guint channels_handled : 1;
+
McdDispatcher *dispatcher;
GList *channels;
@@ -1030,7 +1034,11 @@ mcd_dispatcher_context_check_client_locks (McdDispatcherContext *context)
!context->awaiting_approval)
{
/* no observers etc. left */
- mcd_dispatcher_run_handlers (context);
+ if (!context->channels_handled)
+ {
+ context->channels_handled = TRUE;
+ mcd_dispatcher_run_handlers (context);
+ }
}
}
@@ -1498,12 +1506,7 @@ on_operation_finished (McdDispatchOperation *operation,
{
DEBUG ("Nothing left to dispatch");
- if (context->awaiting_approval)
- {
- /* this would have been released when awaiting_approval changed to
- * FALSE, but now we're never going to do that */
- mcd_dispatcher_context_unref (context, "CTXREF14");
- }
+ context->channels_handled = TRUE;
}
else if (mcd_dispatch_operation_is_claimed (operation))
{
@@ -1521,25 +1524,17 @@ on_operation_finished (McdDispatchOperation *operation,
}
mcd_dispatcher_context_handler_done (context);
-
- /* this would have been released when awaiting_approval changed to
- * FALSE, but now we're never going to do that */
- g_assert (context->awaiting_approval);
- mcd_dispatcher_context_unref (context, "CTXREF14");
+ g_assert (!context->channels_handled);
+ context->channels_handled = TRUE;
}
- else
- {
- /* this is the lock set in mcd_dispatcher_run_approvers(): releasing
- * this will make the handlers run */
- if (context->awaiting_approval)
- {
- context->awaiting_approval = FALSE;
- mcd_dispatcher_context_unref (context, "CTXREF14");
- }
- mcd_dispatcher_context_check_client_locks (context);
+ if (context->awaiting_approval)
+ {
+ context->awaiting_approval = FALSE;
+ mcd_dispatcher_context_unref (context, "CTXREF14");
}
+ mcd_dispatcher_context_check_client_locks (context);
mcd_dispatcher_context_unref (context, "CTXREF15");
}
--
1.5.6.5
More information about the telepathy-commits
mailing list