[next] telepathy-glib: TpTestsSimpleChannelDispatchOperation: have stub values for properties
Simon McVittie
smcv at kemper.freedesktop.org
Tue Mar 18 05:45:05 PDT 2014
Module: telepathy-glib
Branch: next
Commit: 5b573c2368f7d60ba661114905d6a42a1a2eece1
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=5b573c2368f7d60ba661114905d6a42a1a2eece1
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu Mar 13 17:49:32 2014 +0000
TpTestsSimpleChannelDispatchOperation: have stub values for properties
We need to avoid crashing if GetAll() is called on this object.
I'm going to have to make tp_tests_proxy_run_until_dbus_queue_processed
use Properties instead of Introspectable, because of
<https://bugzilla.gnome.org/show_bug.cgi?id=726259>.
---
tests/lib/simple-channel-dispatch-operation.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tests/lib/simple-channel-dispatch-operation.c b/tests/lib/simple-channel-dispatch-operation.c
index bc95fc8..9ac0699 100644
--- a/tests/lib/simple-channel-dispatch-operation.c
+++ b/tests/lib/simple-channel-dispatch-operation.c
@@ -99,6 +99,12 @@ tp_tests_simple_channel_dispatch_operation_init (TpTestsSimpleChannelDispatchOpe
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCH_OPERATION,
TpTestsSimpleChannelDispatchOperationPrivate);
+
+ /* we need something of the appropriate type so GetAll() won't crash */
+ self->priv->chan_path = g_strdup ("/");
+ self->priv->account_path = g_strdup ("/");
+ self->priv->conn_path = g_strdup ("/");
+ self->priv->chan_props = tp_asv_new (NULL, NULL);
}
static void
@@ -240,6 +246,7 @@ tp_tests_simple_channel_dispatch_operation_set_conn_path (
TpTestsSimpleChannelDispatchOperation *self,
const gchar *conn_path)
{
+ g_free (self->priv->conn_path);
self->priv->conn_path = g_strdup (conn_path);
}
@@ -248,9 +255,8 @@ tp_tests_simple_channel_dispatch_operation_set_channel (
TpTestsSimpleChannelDispatchOperation *self,
TpChannel *chan)
{
- g_assert (self->priv->chan_path == NULL);
- g_assert (self->priv->chan_props == NULL);
-
+ g_hash_table_unref (self->priv->chan_props);
+ g_free (self->priv->chan_path);
self->priv->chan_path = g_strdup (tp_proxy_get_object_path (chan));
self->priv->chan_props = tp_tests_dup_channel_props_asv (chan);
}
@@ -260,5 +266,6 @@ tp_tests_simple_channel_dispatch_operation_set_account_path (
TpTestsSimpleChannelDispatchOperation *self,
const gchar *account_path)
{
+ g_free (self->priv->account_path);
self->priv->account_path = g_strdup (account_path);
}
More information about the telepathy-commits
mailing list