From 5bb2c1c62a06e682ab48d530cae5f9614a90a75e Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 16 Nov 2011 15:31:29 +0100 Subject: 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/ --- src/empathy-debug-window.c | 4 ++-- src/empathy-ft-manager.c | 2 +- src/empathy-import-utils.c | 2 +- src/empathy-main-window.c | 6 +++--- src/empathy-map-view.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c index 294c6afe0..80dad106a 100644 --- a/src/empathy-debug-window.c +++ b/src/empathy-debug-window.c @@ -631,7 +631,7 @@ get_cm_display_name (EmpathyDebugWindow *self, retval = g_strdup (cm_name); } - g_hash_table_destroy (protocols); + g_hash_table_unref (protocols); return retval; } @@ -1721,7 +1721,7 @@ debug_window_finalize (GObject *object) debug_message_list_free (values); } - g_hash_table_destroy (priv->cache); + g_hash_table_unref (priv->cache); (G_OBJECT_CLASS (empathy_debug_window_parent_class)->finalize) (object); } diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index 5d2f659f2..606600e99 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -1082,7 +1082,7 @@ empathy_ft_manager_finalize (GObject *object) DEBUG ("FT Manager %p", object); - g_hash_table_destroy (priv->ft_handler_to_row_ref); + g_hash_table_unref (priv->ft_handler_to_row_ref); G_OBJECT_CLASS (empathy_ft_manager_parent_class)->finalize (object); } diff --git a/src/empathy-import-utils.c b/src/empathy-import-utils.c index bf7f29e3b..0c878e8f6 100644 --- a/src/empathy-import-utils.c +++ b/src/empathy-import-utils.c @@ -55,7 +55,7 @@ empathy_import_account_data_free (EmpathyImportAccountData *data) if (data->connection_manager != NULL) g_free (data->connection_manager); if (data->settings != NULL) - g_hash_table_destroy (data->settings); + g_hash_table_unref (data->settings); if (data->source != NULL) g_free (data->source); diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 367ae067f..0e4b8bae5 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1372,8 +1372,8 @@ empathy_main_window_finalize (GObject *window) g_object_unref (priv->individual_store); g_object_unref (priv->contact_manager); g_object_unref (priv->sound_mgr); - g_hash_table_destroy (priv->errors); - g_hash_table_destroy (priv->auths); + g_hash_table_unref (priv->errors); + g_hash_table_unref (priv->auths); /* disconnect all handlers of status-changed signal */ g_hash_table_iter_init (&iter, priv->status_changed_handlers); @@ -1381,7 +1381,7 @@ empathy_main_window_finalize (GObject *window) g_signal_handler_disconnect (TP_ACCOUNT (key), GPOINTER_TO_UINT (value)); - g_hash_table_destroy (priv->status_changed_handlers); + g_hash_table_unref (priv->status_changed_handlers); g_signal_handlers_disconnect_by_func (priv->event_manager, main_window_event_added_cb, diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 9e6cc6dee..72aab0b2c 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -412,7 +412,7 @@ empathy_map_view_finalize (GObject *object) g_signal_handler_disconnect (priv->contact_list, priv->members_changed_id); - g_hash_table_destroy (priv->markers); + g_hash_table_unref (priv->markers); g_object_unref (priv->contact_list); g_object_unref (priv->layer); -- cgit v1.2.3