diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-10 04:14:26 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-10 05:22:23 +0800 |
commit | e502c97d6d477a629209e8cef5dfbc5865b3f385 (patch) | |
tree | c8bea55a182ff32f146b979d8afff99980439388 /libempathy/empathy-contact.c | |
parent | 4fbfc5b9906aff6d4399ddd37b446229e24d0b39 (diff) | |
download | gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar.gz gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar.bz2 gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar.lz gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar.xz gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.tar.zst gsoc2013-empathy-e502c97d6d477a629209e8cef5dfbc5865b3f385.zip |
Don't create an unused hashtable and free location on finalize
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r-- | libempathy/empathy-contact.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 87b66a074..6c7b18c4f 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -262,9 +262,7 @@ empathy_contact_init (EmpathyContact *contact) contact->priv = priv; - priv->location = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) tp_g_value_slice_free); + priv->location = NULL; } static void @@ -283,6 +281,9 @@ contact_finalize (GObject *object) if (priv->avatar) empathy_avatar_unref (priv->avatar); + if (priv->location != NULL) + g_hash_table_unref (priv->location); + G_OBJECT_CLASS (empathy_contact_parent_class)->finalize (object); } @@ -1034,7 +1035,7 @@ empathy_avatar_save_to_file (EmpathyAvatar *self, * Example: a "city" key would have "Helsinki" as string GValue, * a "latitude" would have 65.0 as double GValue. * - * Returns: a #GHashTable of location values + * Returns: a #GHashTable of location values, use #g_hash_table_unref when it to free it */ GHashTable * empathy_contact_get_location (EmpathyContact *contact) @@ -1070,7 +1071,8 @@ empathy_contact_set_location (EmpathyContact *contact, priv = GET_PRIV (contact); - g_hash_table_unref (priv->location); + if (priv->location != NULL) + g_hash_table_unref (priv->location); priv->location = g_hash_table_ref (location); g_object_notify (G_OBJECT (contact), "location"); |