summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-05-23 15:16:46 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-05-23 21:38:01 +0200
commitf455391c8a0e3b81ce0f48fb41e74b16d6b70494 (patch)
tree5e7a141725d928ada086d82c496d8ee153b16979
parent7477c860e9e9d036b7a7e1088898394b25fb828a (diff)
Fix GObject leaks in ibus_property_deserialize()
-rw-r--r--src/ibusproperty.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ibusproperty.c b/src/ibusproperty.c
index 5a3eee03..8d011c6c 100644
--- a/src/ibusproperty.c
+++ b/src/ibusproperty.c
@@ -403,6 +403,9 @@ ibus_property_deserialize (IBusProperty *prop,
g_variant_get_child (variant, retval++, "u", &prop->priv->type);
GVariant *subvar = g_variant_get_child_value (variant, retval++);
+ if (prop->priv->label != NULL) {
+ g_object_unref (prop->priv->label);
+ }
prop->priv->label = IBUS_TEXT (ibus_serializable_deserialize (subvar));
g_object_ref_sink (prop->priv->label);
g_variant_unref (subvar);
@@ -410,6 +413,9 @@ ibus_property_deserialize (IBusProperty *prop,
g_variant_get_child (variant, retval++, "s", &prop->priv->icon);
subvar = g_variant_get_child_value (variant, retval++);
+ if (prop->priv->tooltip != NULL) {
+ g_object_unref (prop->priv->tooltip);
+ }
prop->priv->tooltip = IBUS_TEXT (ibus_serializable_deserialize (subvar));
g_object_ref_sink (prop->priv->tooltip);
g_variant_unref (subvar);
@@ -419,12 +425,18 @@ ibus_property_deserialize (IBusProperty *prop,
g_variant_get_child (variant, retval++, "u", &prop->priv->state);
subvar = g_variant_get_child_value (variant, retval++);
+ if (prop->priv->sub_props != NULL) {
+ g_object_unref (prop->priv->sub_props);
+ }
prop->priv->sub_props = IBUS_PROP_LIST (ibus_serializable_deserialize (subvar));
g_object_ref_sink (prop->priv->sub_props);
g_variant_unref (subvar);
/* Keep the serialized order for the compatibility when add new members. */
subvar = g_variant_get_child_value (variant, retval++);
+ if (prop->priv->symbol != NULL) {
+ g_object_unref (prop->priv->symbol);
+ }
prop->priv->symbol = IBUS_TEXT (ibus_serializable_deserialize (subvar));
g_object_ref_sink (prop->priv->symbol);
g_variant_unref (subvar);