online-accounts: Small cleanup about resource releasing
Use g_clear_object() as a NULL-safe g_object_unref() and g_list_free_full() instead of explicitly iterating the list contents. https://bugzilla.gnome.org/show_bug.cgi?id=695877
This commit is contained in:
parent
d0d33205fa
commit
397181e5d2
2 changed files with 6 additions and 12 deletions
|
@ -250,8 +250,7 @@ goa_panel_add_account_dialog_finalize (GObject *object)
|
|||
GoaPanelAddAccountDialog *add_account = GOA_PANEL_ADD_ACCOUNT_DIALOG (object);
|
||||
GoaPanelAddAccountDialogPrivate *priv = add_account->priv;
|
||||
|
||||
if (priv->error != NULL)
|
||||
g_error_free (priv->error);
|
||||
g_clear_error (&priv->error);
|
||||
|
||||
G_OBJECT_CLASS (goa_panel_add_account_dialog_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -122,12 +122,9 @@ cc_goa_panel_finalize (GObject *object)
|
|||
{
|
||||
CcGoaPanel *panel = CC_GOA_PANEL (object);
|
||||
|
||||
if (panel->accounts_model != NULL)
|
||||
g_clear_object (&panel->accounts_model);
|
||||
|
||||
if (panel->client != NULL)
|
||||
g_object_unref (panel->client);
|
||||
g_object_unref (panel->builder);
|
||||
g_clear_object (&panel->accounts_model);
|
||||
g_clear_object (&panel->client);
|
||||
g_clear_object (&panel->builder);
|
||||
|
||||
G_OBJECT_CLASS (cc_goa_panel_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -476,8 +473,7 @@ show_page_account (CcGoaPanel *panel,
|
|||
|
||||
gtk_widget_show_all (panel->accounts_vbox);
|
||||
|
||||
if (provider != NULL)
|
||||
g_object_unref (provider);
|
||||
g_clear_object (&provider);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
@ -693,8 +689,7 @@ add_account (CcGoaPanel *panel)
|
|||
}
|
||||
|
||||
out:
|
||||
g_list_foreach (providers, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (providers);
|
||||
g_list_free_full (providers, g_object_unref);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
|
Loading…
Add table
Reference in a new issue