[Telepathy-commits] [telepathy-mission-control/master] Fix re-dispatching of existing channels

Alberto Mardegan alberto.mardegan at nokia.com
Wed Dec 10 06:32:54 PST 2008


* Fix typo: get the status of the existing channel.
* Copy the status from the existing channel into the requested one, even if it
  has already been dispatched (this will also take care of signalling that the
  request succeeded)
* Fix reference counting.
---
 src/mcd-channel.c    |   12 ++++++++----
 src/mcd-connection.c |    9 +++------
 src/mcd-dispatcher.c |    2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index 3491ee1..225f842 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -864,10 +864,14 @@ mcd_channel_set_status (McdChannel *channel, McdChannelStatus status)
 {
     g_debug ("%s: %p, %u", G_STRFUNC, channel, status);
     g_return_if_fail(MCD_IS_CHANNEL(channel));
-    g_object_ref (channel);
-    g_signal_emit_by_name (channel, "status-changed", status);
-    channel->priv->status = status;
-    g_object_unref (channel);
+
+    if (status != channel->priv->status)
+    {
+        g_object_ref (channel);
+        g_signal_emit_by_name (channel, "status-changed", status);
+        channel->priv->status = status;
+        g_object_unref (channel);
+    }
 }
 
 McdChannelStatus
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index 5ffb6ad..be63246 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -2198,17 +2198,14 @@ common_request_channel_cb (TpConnection *proxy, gboolean yours,
              * 2) if @existing is already dispatched, we must re-invoke its
              * handler
              */
-            if (mcd_channel_get_status (channel) ==
+            if (mcd_channel_get_status (existing) ==
                 MCD_CHANNEL_STATUS_DISPATCHED)
             {
                 g_debug ("reinvoking handler on channel %p", existing);
                 _mcd_dispatcher_reinvoke_handler (priv->dispatcher, existing);
             }
-            else
-            {
-                g_debug ("channel %p is proxying %p", channel, existing);
-                _mcd_channel_set_request_proxy (channel, existing);
-            }
+            g_debug ("channel %p is proxying %p", channel, existing);
+            _mcd_channel_set_request_proxy (channel, existing);
             return;
         }
     }
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 34332cd..5f46dda 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -3156,6 +3156,6 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
      * mcd_dispatcher_context_unref() will unref() it */
     g_object_ref (channel);
     mcd_dispatcher_run_handlers (context);
-    mcd_dispatcher_context_unref (context);
+    /* the context will be unreferenced once it leaves the state machine */
 }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list