summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-13 17:49:32 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-17 15:43:53 +0000
commit5b573c2368f7d60ba661114905d6a42a1a2eece1 (patch)
tree2c13172d86963e7acd5a40425a9573f5d8a749fa
parent6810c4a561ed01c28f7cf7ad594c363755421153 (diff)
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>.
-rw-r--r--tests/lib/simple-channel-dispatch-operation.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/lib/simple-channel-dispatch-operation.c b/tests/lib/simple-channel-dispatch-operation.c
index bc95fc811..9ac06992b 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);
}