[Telepathy-commits] [telepathy-mission-control/master] Add channel GError on dispatch failure

Alberto Mardegan alberto.mardegan at nokia.com
Mon Nov 17 00:05:22 PST 2008


We must set an error on the channel (this will also set the channel status to
FAILED), as listeners of the "status-changed" signal expect to find one.
---
 src/mcd-dispatcher.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 5c792c5..8acc9ff 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -678,11 +678,10 @@ _mcd_dispatcher_handle_channel_async_cb (DBusGProxy * proxy, GError * error,
 	mc_error = g_error_new (MC_ERROR, MC_CHANNEL_REQUEST_GENERIC_ERROR,
 				"Handle channel failed: %s", error->message);
 
-        mcd_channel_set_status (channel, MCD_CHANNEL_FAILED);
+        _mcd_channel_set_error (channel, mc_error);
 	g_signal_emit_by_name (context->dispatcher, "dispatch-failed",
 			       channel, mc_error);
 	
-	g_error_free (mc_error);
 	g_error_free (error);
 	if (channel)
 	    mcd_mission_abort (MCD_MISSION (channel));
@@ -759,10 +758,9 @@ start_old_channel_handler (McdDispatcherContext *context)
 	mc_error = g_error_new (MC_ERROR, MC_CHANNEL_REQUEST_GENERIC_ERROR,
 				"No handler for channel type %s",
 				mcd_channel_get_channel_type (channel));
-        mcd_channel_set_status (channel, MCD_CHANNEL_FAILED);
+        _mcd_channel_set_error (channel, mc_error);
 	g_signal_emit_by_name (context->dispatcher, "dispatch-failed", channel,
 			       mc_error);
-	g_error_free (mc_error);
         mcd_dispatcher_context_handler_done (context);
     }
     else
@@ -911,7 +909,7 @@ handle_channels_cb (TpProxy *proxy, const GError *error, gpointer user_data,
         {
             McdChannel *channel = MCD_CHANNEL (list->data);
 
-            mcd_channel_set_status (channel, MCD_CHANNEL_FAILED);
+            _mcd_channel_set_error (channel, g_error_copy (mc_error));
             g_signal_emit_by_name (context->dispatcher, "dispatch-failed",
                                    channel, mc_error);
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list