[telepathy-mission-control/master] Keep the context alive

Alberto Mardegan alberto.mardegan at nokia.com
Mon Apr 20 04:15:40 PDT 2009


Don't let the context be freed in the middle of a function.
This was causing a crash, if the handler returned an error: the channel was
aborted, therefore removed from the DispatchOperation, which in turn emitted
the Finished signal. This caused the mcd_dispatcher_context_handler_done() to
be called and free the context, which would still be used later.
---
 src/mcd-dispatcher.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index ba835ae..d3d21ae 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -927,6 +927,7 @@ handle_channels_cb (TpProxy *proxy, const GError *error, gpointer user_data,
     McdDispatcherContext *context = call_data->context;
     GList *list;
 
+    mcd_dispatcher_context_ref (context); /* unref is done before return */
     if (error)
     {
         GError *mc_error = NULL;
@@ -966,6 +967,7 @@ handle_channels_cb (TpProxy *proxy, const GError *error, gpointer user_data,
     }
 
     mcd_dispatcher_context_handler_done (context);
+    mcd_dispatcher_context_unref (context);
 }
 
 static GStrv
-- 
1.5.6.5




More information about the telepathy-commits mailing list