[telepathy-mission-control/master] McdDispatchOperation: artificially stay alive while running clients, and while calling out to other code

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 2 06:41:46 PST 2009


This ensures that once a dispatch operation is dispatching, it will finish
properly, even if all external references are released.
---
 src/mcd-dispatch-operation.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index c1d0138..4b5d9c3 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -451,6 +451,8 @@ mcd_dispatch_operation_set_channel_handled_by (McdDispatchOperation *self,
 static void
 mcd_dispatch_operation_actually_finish (McdDispatchOperation *self)
 {
+    g_object_ref (self);
+
     DEBUG ("%s/%p: finished", self->priv->unique_name, self);
     tp_svc_channel_dispatch_operation_emit_finished (self);
 
@@ -492,6 +494,8 @@ mcd_dispatch_operation_actually_finish (McdDispatchOperation *self)
         tp_svc_channel_dispatch_operation_return_from_claim (self->priv->claim_context);
         self->priv->claim_context = NULL;
     }
+
+    g_object_unref (self);
 }
 
 gboolean
@@ -1673,6 +1677,8 @@ _mcd_dispatch_operation_run_approvers (McdDispatchOperation *self)
 void
 _mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
 {
+    g_object_ref (self);
+
     _mcd_dispatch_operation_run_observers (self);
 
     /* if the dispatch operation thinks the channels were not
@@ -1693,6 +1699,8 @@ _mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
 
     self->priv->invoked_early_clients = TRUE;
     _mcd_dispatch_operation_check_client_locks (self);
+
+    g_object_unref (self);
 }
 
 /*
-- 
1.5.6.5




More information about the telepathy-commits mailing list