diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-09-11 18:35:26 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-09-11 21:10:43 +0800 |
commit | 6a5b51b273fc447c7611675b97268fc99216d430 (patch) | |
tree | 1c3b87bd9aea1d122dbb829c6c3bcec831fed9c6 | |
parent | 57b261b8329e12d1ffcc46e7ecfbeca2caa8fb4b (diff) | |
download | gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar.gz gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar.bz2 gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar.lz gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar.xz gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.tar.zst gsoc2013-empathy-6a5b51b273fc447c7611675b97268fc99216d430.zip |
use tp_account_manager_dup_valid_accounts()
tp_account_manager_get_valid_accounts() has been deprecated.
Fix an accounts list leak in empathy-sanity-cleaning.
23 files changed, 58 insertions, 55 deletions
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index ae3f1dd15..6e7ec2940 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -280,7 +280,7 @@ account_manager_prepared_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l != NULL; l = l->next) { @@ -301,7 +301,7 @@ account_manager_prepared_cb (GObject *source_object, self, 0); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); if (self->priv->select_when_ready != NULL) { diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 6eb1443d7..308587b52 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -3518,7 +3518,7 @@ account_manager_prepared_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (account_manager); + accounts = tp_account_manager_dup_valid_accounts (account_manager); for (l = accounts; l != NULL; l = l->next) { TpAccount *account = l->data; @@ -3527,7 +3527,7 @@ account_manager_prepared_cb (GObject *source_object, chat, 0); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void diff --git a/libempathy-gtk/empathy-contact-blocking-dialog.c b/libempathy-gtk/empathy-contact-blocking-dialog.c index 58d574925..9a0498c5a 100644 --- a/libempathy-gtk/empathy-contact-blocking-dialog.c +++ b/libempathy-gtk/empathy-contact-blocking-dialog.c @@ -234,7 +234,7 @@ contact_blocking_dialog_am_prepared (GObject *am, return; } - accounts = tp_account_manager_get_valid_accounts (TP_ACCOUNT_MANAGER (am)); + accounts = tp_account_manager_dup_valid_accounts (TP_ACCOUNT_MANAGER (am)); for (ptr = accounts; ptr != NULL; ptr = ptr->next) { @@ -247,7 +247,7 @@ contact_blocking_dialog_am_prepared (GObject *am, contact_blocking_dialog_refilter_account_chooser (self); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void diff --git a/libempathy-gtk/empathy-contact-chooser.c b/libempathy-gtk/empathy-contact-chooser.c index 880646711..69cfdef69 100644 --- a/libempathy-gtk/empathy-contact-chooser.c +++ b/libempathy-gtk/empathy-contact-chooser.c @@ -283,7 +283,7 @@ add_temporary_individuals (EmpathyContactChooser *self, self->priv->add_temp_ctx = add_temporary_individual_ctx_new (self); /* Try to add an individual for each connected account */ - accounts = tp_account_manager_get_valid_accounts (self->priv->account_mgr); + accounts = tp_account_manager_dup_valid_accounts (self->priv->account_mgr); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -303,7 +303,7 @@ add_temporary_individuals (EmpathyContactChooser *self, g_object_unref (factory); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index c485b9b5f..6058c4938 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -288,7 +288,7 @@ find_phone_accounts (void) am = tp_account_manager_dup (); g_return_val_if_fail (am != NULL, NULL); - accounts = tp_account_manager_get_valid_accounts (am); + accounts = tp_account_manager_dup_valid_accounts (am); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -303,7 +303,7 @@ find_phone_accounts (void) found = g_list_prepend (found, g_object_ref (account)); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); g_object_unref (am); return found; diff --git a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c index c55e3ab30..b714fa499 100644 --- a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c +++ b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c @@ -223,7 +223,7 @@ empathy_local_xmpp_assistant_widget_should_create_account ( gboolean salut_created = FALSE; GList *accounts, *l; - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l != NULL; l = g_list_next (l)) { @@ -236,7 +236,7 @@ empathy_local_xmpp_assistant_widget_should_create_account ( } } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); return !salut_created; } diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c index 233afb788..576ced529 100644 --- a/libempathy-gtk/empathy-location-manager.c +++ b/libempathy-gtk/empathy-location-manager.c @@ -189,7 +189,7 @@ publish_to_all_am_prepared_cb (GObject *source_object, goto out; } - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l; l = l->next) { TpConnection *conn = tp_account_get_connection (TP_ACCOUNT (l->data)); @@ -197,7 +197,7 @@ publish_to_all_am_prepared_cb (GObject *source_object, if (conn != NULL) publish_location (data->self, conn, data->force_publication); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); out: g_object_unref (data->self); @@ -675,7 +675,7 @@ account_manager_prepared_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (account_manager); + accounts = tp_account_manager_dup_valid_accounts (account_manager); for (l = accounts; l != NULL; l = l->next) { TpAccount *account = TP_ACCOUNT (l->data); @@ -683,7 +683,7 @@ account_manager_prepared_cb (GObject *source_object, tp_g_signal_connect_object (account, "status-changed", G_CALLBACK (new_connection_cb), self, 0); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index ff274a6aa..6a244f503 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -2499,7 +2499,7 @@ log_window_who_populate (EmpathyLogWindow *self) GList *accounts, *l; manager = empathy_account_chooser_get_account_manager (account_chooser); - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l != NULL; l = l->next) { @@ -2510,7 +2510,7 @@ log_window_who_populate (EmpathyLogWindow *self) get_entities_for_account, ctx); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } _tpl_action_chain_append (self->priv->chain, select_first_entity, self); _tpl_action_chain_start (self->priv->chain); diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 08325d402..1eb4a48a5 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -759,7 +759,7 @@ update_sensitivity_am_prepared_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts ; l != NULL ; l = g_list_next (l)) { TpAccount *a = TP_ACCOUNT (l->data); @@ -770,7 +770,7 @@ update_sensitivity_am_prepared_cb (GObject *source_object, } } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); if (!g_network_monitor_get_network_available (priv->connectivity)) sensitive = FALSE; diff --git a/libempathy/empathy-connection-aggregator.c b/libempathy/empathy-connection-aggregator.c index 2b517bf51..8d05b6c28 100644 --- a/libempathy/empathy-connection-aggregator.c +++ b/libempathy/empathy-connection-aggregator.c @@ -188,7 +188,7 @@ am_prepare_cb (GObject *source, goto out; } - accounts = tp_account_manager_get_valid_accounts (self->priv->mgr); + accounts = tp_account_manager_dup_valid_accounts (self->priv->mgr); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -199,7 +199,7 @@ am_prepare_cb (GObject *source, tp_g_signal_connect_object (self->priv->mgr, "account-validity-changed", G_CALLBACK (account_validity_changed_cb), self, 0); - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); out: g_object_unref (self); diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c index 9b1a39217..29af2a107 100644 --- a/libempathy/empathy-presence-manager.c +++ b/libempathy/empathy-presence-manager.c @@ -433,13 +433,13 @@ account_manager_ready_cb (GObject *source_object, most_available_presence_changed (account_manager, state, status, status_message, self); - accounts = tp_account_manager_get_valid_accounts (self->priv->manager); + accounts = tp_account_manager_dup_valid_accounts (self->priv->manager); for (l = accounts; l != NULL; l = l->next) { tp_g_signal_connect_object (l->data, "status-changed", G_CALLBACK (account_status_changed_cb), self, 0); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); g_free (status); g_free (status_message); diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index cc518c0b0..eb1e27f4c 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -567,7 +567,7 @@ empathy_account_manager_get_accounts_connected (gboolean *connecting) TP_ACCOUNT_MANAGER_FEATURE_CORE))) g_critical (G_STRLOC ": %s called before AccountManager ready", G_STRFUNC); - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l != NULL; l = l->next) { @@ -583,7 +583,7 @@ empathy_account_manager_get_accounts_connected (gboolean *connecting) break; } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); g_object_unref (manager); if (connecting != NULL) diff --git a/src/empathy-accounts-common.c b/src/empathy-accounts-common.c index 7550c7183..d975c55b0 100644 --- a/src/empathy-accounts-common.c +++ b/src/empathy-accounts-common.c @@ -51,7 +51,7 @@ empathy_accounts_has_non_salut_accounts (TpAccountManager *manager) gboolean ret = FALSE; GList *accounts, *l; - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts ; l != NULL; l = g_list_next (l)) { @@ -62,7 +62,7 @@ empathy_accounts_has_non_salut_accounts (TpAccountManager *manager) } } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); return ret; } @@ -73,9 +73,9 @@ empathy_accounts_has_accounts (TpAccountManager *manager) GList *accounts; gboolean has_accounts; - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); has_accounts = (accounts != NULL); - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); return has_accounts; } diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index cb8c7f784..3234cead4 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -2199,12 +2199,12 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog) dialog); /* Add existing accounts */ - accounts = tp_account_manager_get_valid_accounts (priv->account_manager); + accounts = tp_account_manager_dup_valid_accounts (priv->account_manager); for (l = accounts; l; l = l->next) { accounts_dialog_add_account (dialog, l->data); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); priv->cms = empathy_connection_managers_dup_singleton (); diff --git a/src/empathy-accounts.c b/src/empathy-accounts.c index 027d99918..aa0e5b67b 100644 --- a/src/empathy-accounts.c +++ b/src/empathy-accounts.c @@ -77,7 +77,7 @@ find_account (TpAccountManager *mgr, GList *accounts, *l; TpAccount *found = NULL; - accounts = tp_account_manager_get_valid_accounts (mgr); + accounts = tp_account_manager_dup_valid_accounts (mgr); for (l = accounts; l != NULL; l = g_list_next (l)) { if (!tp_strdiff (tp_proxy_get_object_path (l->data), path)) @@ -87,7 +87,7 @@ find_account (TpAccountManager *mgr, } } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); return found; } diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c index 11c33453d..159db0b09 100644 --- a/src/empathy-debug-window.c +++ b/src/empathy-debug-window.c @@ -795,7 +795,7 @@ get_cm_display_name (EmpathyDebugWindow *self, GList *accounts, *ptr; char *retval; - accounts = tp_account_manager_get_valid_accounts (self->priv->am); + accounts = tp_account_manager_dup_valid_accounts (self->priv->am); for (ptr = accounts; ptr != NULL; ptr = ptr->next) { @@ -809,7 +809,7 @@ get_cm_display_name (EmpathyDebugWindow *self, } } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); if (g_hash_table_size (protocols) > 0) { diff --git a/src/empathy-import-widget.c b/src/empathy-import-widget.c index b65e0c0cf..1994280ee 100644 --- a/src/empathy-import-widget.c +++ b/src/empathy-import-widget.c @@ -123,14 +123,14 @@ import_widget_add_accounts_to_model (EmpathyImportWidget *self) value = g_hash_table_lookup (data->settings, "account"); - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); /* Only set the "Import" cell to be active if there isn't already an * account set up with the same account id. */ import = !import_widget_account_id_in_list (accounts, g_value_get_string (value)); - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, -1, COL_IMPORT, import, diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c index f0b30cf77..8ce915396 100644 --- a/src/empathy-roster-window.c +++ b/src/empathy-roster-window.c @@ -1507,7 +1507,7 @@ set_notebook_page (EmpathyRosterWindow *self) gtk_spinner_stop (GTK_SPINNER (self->priv->spinner_loading)); - accounts = tp_account_manager_get_valid_accounts ( + accounts = tp_account_manager_dup_valid_accounts ( self->priv->account_manager); len = g_list_length (accounts); @@ -1560,7 +1560,7 @@ set_notebook_page (EmpathyRosterWindow *self) display_page_contact_list (self); out: - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void @@ -1636,7 +1636,8 @@ account_manager_prepared_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (self->priv->account_manager); + accounts = tp_account_manager_dup_valid_accounts ( + self->priv->account_manager); for (j = accounts; j != NULL; j = j->next) { TpAccount *account = TP_ACCOUNT (j->data); @@ -1655,7 +1656,7 @@ account_manager_prepared_cb (GObject *source_object, set_notebook_page (self); - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } void diff --git a/src/empathy-sanity-cleaning.c b/src/empathy-sanity-cleaning.c index e810fcb29..60cecc972 100644 --- a/src/empathy-sanity-cleaning.c +++ b/src/empathy-sanity-cleaning.c @@ -126,7 +126,7 @@ fix_xmpp_account_priority (TpAccountManager *am) { GList *accounts, *l; - accounts = tp_account_manager_get_valid_accounts (am); + accounts = tp_account_manager_dup_valid_accounts (am); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -157,7 +157,7 @@ fix_xmpp_account_priority (TpAccountManager *am) g_hash_table_unref (params); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void @@ -165,7 +165,7 @@ set_facebook_account_fallback_server (TpAccountManager *am) { GList *accounts, *l; - accounts = tp_account_manager_get_valid_accounts (am); + accounts = tp_account_manager_dup_valid_accounts (am); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -197,7 +197,7 @@ set_facebook_account_fallback_server (TpAccountManager *am) g_hash_table_unref (params); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void @@ -540,7 +540,7 @@ migrate_accounts_to_uoa (SanityCtx *ctx) manager = empathy_uoa_manager_dup (); - accounts = tp_account_manager_get_valid_accounts (ctx->am); + accounts = tp_account_manager_dup_valid_accounts (ctx->am); for (l = accounts; l != NULL; l = g_list_next (l)) { TpAccount *account = l->data; @@ -562,6 +562,8 @@ migrate_accounts_to_uoa (SanityCtx *ctx) migrate_account_to_uoa (ctx->am, account); } + g_list_free_full (accounts, g_object_unref); + g_object_unref (manager); } #endif diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index 3aa27a467..517dd1df2 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -445,13 +445,13 @@ account_manager_prepared_cb (GObject *source_object, return; } - list = tp_account_manager_get_valid_accounts (account_manager); + list = tp_account_manager_dup_valid_accounts (account_manager); for (l = list; l != NULL; l = l->next) { tp_g_signal_connect_object (l->data, "status-changed", G_CALLBACK (status_icon_status_changed_cb), icon, 0); } - g_list_free (list); + g_list_free_full (list, g_object_unref); status_icon_presence_changed_cb (icon); } diff --git a/src/empathy.c b/src/empathy.c index 70b45bb34..a75cf3e16 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -709,7 +709,7 @@ account_manager_chatroom_ready_cb (GObject *source_object, return; } - accounts = tp_account_manager_get_valid_accounts (account_manager); + accounts = tp_account_manager_dup_valid_accounts (account_manager); for (l = accounts; l != NULL; l = g_list_next (l)) { @@ -722,7 +722,7 @@ account_manager_chatroom_ready_cb (GObject *source_object, tp_g_signal_connect_object (account, "notify::connection", G_CALLBACK (account_connection_changed_cb), chatroom_manager, 0); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); } static void diff --git a/ubuntu-online-accounts/cc-plugins/account-plugins/empathy-accounts-plugin-widget.c b/ubuntu-online-accounts/cc-plugins/account-plugins/empathy-accounts-plugin-widget.c index f76eb5cd4..34729960c 100644 --- a/ubuntu-online-accounts/cc-plugins/account-plugins/empathy-accounts-plugin-widget.c +++ b/ubuntu-online-accounts/cc-plugins/account-plugins/empathy-accounts-plugin-widget.c @@ -310,7 +310,7 @@ manager_prepared_cb (GObject *source, goto out; } - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); while (accounts != NULL) { TpAccount *account = accounts->data; @@ -328,7 +328,7 @@ manager_prepared_cb (GObject *source, accounts = g_list_delete_link (accounts, accounts); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); out: tp_weak_ref_destroy (wr); diff --git a/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c b/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c index d07982a3b..768f0965d 100644 --- a/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c +++ b/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c @@ -195,7 +195,7 @@ manager_prepared_cb (GObject *source, goto out; } - accounts = tp_account_manager_get_valid_accounts (manager); + accounts = tp_account_manager_dup_valid_accounts (manager); while (accounts != NULL) { TpAccount *account = accounts->data; @@ -219,7 +219,7 @@ manager_prepared_cb (GObject *source, accounts = g_list_delete_link (accounts, accounts); } - g_list_free (accounts); + g_list_free_full (accounts, g_object_unref); out: tp_weak_ref_destroy (wr); |