[telepathy-mission-control/master] McdDispatcher: fix the McdDispatcherContext reference-leak

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 28 06:52:13 PDT 2009


We never release all the client locks if there are no channels left. As
a result, if some client locks are held (i.e. we have taken a reference
to the context that will be released when all locks are released), we need
to release the reference at the point that we decide not to release the
locks.
---
 src/mcd-dispatcher.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 839f500..8340116 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1471,6 +1471,13 @@ on_operation_finished (McdDispatchOperation *operation,
     if (context->channels == NULL)
     {
         DEBUG ("Nothing left to dispatch");
+
+        if (context->client_locks > 0)
+        {
+            /* this would have been released when all the locks were released,
+             * but now we're never going to do that */
+            mcd_dispatcher_context_unref (context, "CTXREF13");
+        }
     }
     else if (mcd_dispatch_operation_is_claimed (operation))
     {
@@ -1494,6 +1501,7 @@ on_operation_finished (McdDispatchOperation *operation,
 
         /* this would have been released when all the locks were released, but
          * we're never going to do that */
+        g_assert (context->client_locks > 0);
         mcd_dispatcher_context_unref (context, "CTXREF13");
     }
     else
-- 
1.5.6.5




More information about the telepathy-commits mailing list