[telepathy-mission-control/master] Move references around

Alberto Mardegan alberto.mardegan at nokia.com
Thu May 7 23:32:05 PDT 2009


Reduce the number of code paths to follow in order to track context references:
the unref originally done in _mcd_dispatcher_context_abort() is moved after the
invocation of this function, and will be done even in the case when dispatching
can continue to handlers; a new ref is added in that case, then.

(this patch doesn't change the total number of references)
---
 src/mcd-dispatcher.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index c9dee00..1690d91 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1271,7 +1271,6 @@ _mcd_dispatcher_context_abort (McdDispatcherContext *context,
          * of just aborting them */
         mcd_mission_abort (MCD_MISSION (channel));
     }
-    mcd_dispatcher_context_unref (context);
 }
 
 static void
@@ -2443,6 +2442,7 @@ mcd_dispatcher_context_process (McdDispatcherContext * context, gboolean result)
 	else
 	{
 	    /* Context would be destroyed somewhere in this call */
+            mcd_dispatcher_context_ref (context);
 	    mcd_dispatcher_run_clients (context);
 	}
     }
@@ -2465,6 +2465,7 @@ mcd_dispatcher_context_process (McdDispatcherContext * context, gboolean result)
         }
         _mcd_dispatcher_context_abort (context, &error);
     }
+    mcd_dispatcher_context_unref (context);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list