summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-10 16:10:22 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-10 16:10:22 +0100
commit92991d03cd048b40e597e0b8b87712093ddf1844 (patch)
treef4d2dbd2de60522e8628d8785eef595a3e511829
parent00f0133f43d96008230378c3245034fee82c287c (diff)
TpChannelDispatchOperation: defer interpretation of immutables until constructed
Without this change, the CDO's behaviour would depend on the order of g_object_new arguments: * if cdo-properties came before account: make a new TpAccount, which is then leaked (overwritten with an existing TpAccount, but not freed) when the account property is set * if account came before cdo-properties: behave correctly (use the existing TpAccount) The corresponding order-dependent bug could happen for connection too. By delaying the maybe_set functions until constructed(), we force the latter (correct) ordering in all cases.
-rw-r--r--telepathy-glib/channel-dispatch-operation.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c
index c8d7462d..3aa86cca 100644
--- a/telepathy-glib/channel-dispatch-operation.c
+++ b/telepathy-glib/channel-dispatch-operation.c
@@ -407,22 +407,6 @@ tp_channel_dispatch_operation_set_property (GObject *object,
tp_g_hash_table_update (self->priv->immutable_properties,
asv, (GBoxedCopyFunc) g_strdup,
(GBoxedCopyFunc) tp_g_value_slice_dup);
-
- maybe_set_connection (self, tp_asv_get_boxed (asv,
- TP_PROP_CHANNEL_DISPATCH_OPERATION_CONNECTION,
- DBUS_TYPE_G_OBJECT_PATH));
-
- maybe_set_account (self, tp_asv_get_boxed (asv,
- TP_PROP_CHANNEL_DISPATCH_OPERATION_ACCOUNT,
- DBUS_TYPE_G_OBJECT_PATH));
-
- maybe_set_possible_handlers (self, tp_asv_get_boxed (asv,
- TP_PROP_CHANNEL_DISPATCH_OPERATION_POSSIBLE_HANDLERS,
- G_TYPE_STRV));
-
- maybe_set_interfaces (self, tp_asv_get_boxed (asv,
- TP_PROP_CHANNEL_DISPATCH_OPERATION_INTERFACES,
- G_TYPE_STRV));
}
break;
@@ -446,6 +430,26 @@ tp_channel_dispatch_operation_constructed (GObject *object)
g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
+ maybe_set_connection (self,
+ tp_asv_get_boxed (self->priv->immutable_properties,
+ TP_PROP_CHANNEL_DISPATCH_OPERATION_CONNECTION,
+ DBUS_TYPE_G_OBJECT_PATH));
+
+ maybe_set_account (self,
+ tp_asv_get_boxed (self->priv->immutable_properties,
+ TP_PROP_CHANNEL_DISPATCH_OPERATION_ACCOUNT,
+ DBUS_TYPE_G_OBJECT_PATH));
+
+ maybe_set_possible_handlers (self,
+ tp_asv_get_boxed (self->priv->immutable_properties,
+ TP_PROP_CHANNEL_DISPATCH_OPERATION_POSSIBLE_HANDLERS,
+ G_TYPE_STRV));
+
+ maybe_set_interfaces (self,
+ tp_asv_get_boxed (self->priv->immutable_properties,
+ TP_PROP_CHANNEL_DISPATCH_OPERATION_INTERFACES,
+ G_TYPE_STRV));
+
sc = tp_cli_channel_dispatch_operation_connect_to_finished (self,
tp_channel_dispatch_operation_finished_cb, NULL, NULL, NULL, &error);