diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:35:10 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:35:31 +0100 |
commit | b7cfa229c65ecba4d4a5e9e0ea90331e9d5bb269 (patch) | |
tree | 8ea475c882ba20c8b42bcc7348c361e8b55ceb54 /src/contact.c | |
parent | 54f726c81670463a8bf16b4cd002d258f03aa05a (diff) | |
download | telepathy-salut-b7cfa229c65ecba4d4a5e9e0ea90331e9d5bb269.tar.gz |
Use _unref instead of _free _destroy when possible.unref
Replace g_(ptr_)array_free (foo, TRUE) and g_hash_table_destroy
with respectively g_(ptr_)array_unref (foo) and g_hash_table_unref.
I used this command to generate this patch:
for f in `find -name "*.c"`; do sed -i $f -re 's/g_ptr_array_free \(([^ ,]+), TRUE\)/g_ptr_array_unref \(\1\)/'; done
See Danielle's blog for explanation of possible bug _free can do:
http://blogs.gnome.org/danni/2011/11/16/mistakes-with-g_value_set_boxed/
Diffstat (limited to 'src/contact.c')
-rw-r--r-- | src/contact.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/contact.c b/src/contact.c index 66f090af..c04c21c9 100644 --- a/src/contact.c +++ b/src/contact.c @@ -306,7 +306,7 @@ salut_contact_dispose (GObject *object) g_hash_table_foreach (priv->olpc_activities, (GHFunc) disconnect_activity_signal_foreach, self); - g_hash_table_destroy (priv->olpc_activities); + g_hash_table_unref (priv->olpc_activities); #endif salut_contact_avatar_request_flush (self, NULL, 0); @@ -350,7 +350,7 @@ salut_contact_finalize (GObject *object) #ifdef ENABLE_OLPC if (self->olpc_key != NULL) { - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); } g_free (self->olpc_color); g_free (self->olpc_cur_act); @@ -674,7 +674,7 @@ salut_contact_change_olpc_key (SalutContact *self, GArray *olpc_key) { if (self->olpc_key != NULL) { - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); } self->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8), olpc_key->len); |