telepathy-mission-control: mcd_dispatcher_dup_possible_handlers: only take one TpChannel

Simon McVittie smcv at kemper.freedesktop.org
Tue Jul 31 03:41:19 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: a30524b98da9403099dc303602b432d1b384237e
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=a30524b98da9403099dc303602b432d1b384237e

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Jul 20 11:51:38 2012 +0100

mcd_dispatcher_dup_possible_handlers: only take one TpChannel

https://bugs.freedesktop.org/show_bug.cgi?id=52305

---

 src/mcd-dispatcher.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 9c17050..1807f20 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -178,9 +178,10 @@ mcd_dispatcher_dup_internal_handlers (void)
 static GStrv
 mcd_dispatcher_dup_possible_handlers (McdDispatcher *self,
                                       McdRequest *request,
-                                      const GList *channels,
+                                      TpChannel *channel,
                                       const gchar *must_have_unique_name)
 {
+    GList *channels = g_list_prepend (NULL, channel);
     GList *handlers = _mcd_client_registry_list_possible_handlers (
         self->priv->clients,
         request != NULL ? _mcd_request_get_preferred_handler (request) : NULL,
@@ -191,6 +192,8 @@ mcd_dispatcher_dup_possible_handlers (McdDispatcher *self,
     GStrv ret;
     const GList *iter;
 
+    g_list_free (channels);
+
     if (handlers == NULL)
         return NULL;
 
@@ -939,7 +942,6 @@ _mcd_dispatcher_add_channel (McdDispatcher *dispatcher,
 {
     GList *channels = NULL;
     TpChannel *tp_channel = NULL;
-    GList *tp_channels = NULL;
     GStrv possible_handlers;
     McdRequest *request = NULL;
     gboolean internal_request = FALSE;
@@ -970,7 +972,6 @@ _mcd_dispatcher_add_channel (McdDispatcher *dispatcher,
      * It might also have the McdRequest part. */
     tp_channel = mcd_channel_get_tp_channel (channel);
     g_assert (tp_channel != NULL);
-    tp_channels = g_list_prepend (NULL, g_object_ref (tp_channel));
 
     request = _mcd_channel_get_request (channel);
     internal_request = _mcd_request_is_internal (request);
@@ -981,12 +982,9 @@ _mcd_dispatcher_add_channel (McdDispatcher *dispatcher,
     else
         possible_handlers = mcd_dispatcher_dup_possible_handlers (dispatcher,
                                                                   request,
-                                                                  tp_channels,
+                                                                  tp_channel,
                                                                   NULL);
 
-    g_list_foreach (tp_channels, (GFunc) g_object_unref, NULL);
-    g_list_free (tp_channels);
-
     if (possible_handlers == NULL)
     {
         DEBUG ("Channel cannot be handled - making a CDO "
@@ -2091,16 +2089,11 @@ add_possible_handlers (McdDispatcher *self,
     const gchar *sender,
     const gchar *preferred_handler)
 {
-    GList *channels = NULL;
     GStrv possible_handlers;
     guint i;
 
-    channels = g_list_prepend (channels, tp_channel);
-
     possible_handlers = mcd_dispatcher_dup_possible_handlers (self,
-        NULL, channels, NULL);
-
-    g_list_free (channels);
+        NULL, tp_channel, NULL);
 
     for (i = 0; possible_handlers[i] != NULL; i++)
       {



More information about the telepathy-commits mailing list