[telepathy-gabble/master] Initialize remote_credentials in init.

Mike Ruprecht mike.ruprecht at collabora.co.uk
Tue Dec 29 05:35:10 PST 2009


This allows the get handler to be simplified and fixes a possible issue of
freeing remote_credentials without it necessarily having been set.
---
 src/call-stream-endpoint.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/call-stream-endpoint.c b/src/call-stream-endpoint.c
index 9606f84..906c6d5 100644
--- a/src/call-stream-endpoint.c
+++ b/src/call-stream-endpoint.c
@@ -89,6 +89,11 @@ gabble_call_stream_endpoint_init (GabbleCallStreamEndpoint *self)
       GABBLE_HASH_TYPE_CANDIDATE_INFO,
           g_hash_table_new (g_str_hash, g_str_equal),
       G_TYPE_INVALID);
+
+  priv->remote_credentials = gabble_value_array_build (2,
+      G_TYPE_STRING, "",
+      G_TYPE_STRING, "",
+      G_TYPE_INVALID);
 }
 
 static void gabble_call_stream_endpoint_dispose (GObject *object);
@@ -124,19 +129,7 @@ gabble_call_stream_endpoint_get_property (GObject    *object,
         }
       case PROP_REMOTE_CREDENTIALS:
         {
-          if (priv->remote_credentials == NULL)
-            {
-              GValueArray *va = gabble_value_array_build (2,
-                  G_TYPE_STRING, "",
-                  G_TYPE_STRING, "",
-                  G_TYPE_INVALID);
-              g_value_set_boxed (value, va);
-              g_boxed_free (G_TYPE_VALUE_ARRAY, va);
-            }
-          else
-            {
-              g_value_set_boxed (value, priv->remote_credentials);
-            }
+          g_value_set_boxed (value, priv->remote_credentials);
           break;
         }
       case PROP_SELECTED_CANDIDATE:
-- 
1.5.6.5




More information about the telepathy-commits mailing list