aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Tellier <jonathan.tellier@gmail.com>2009-08-29 02:19:47 +0800
committerjtellier <jonathan.tellier@collabora.co.uk>2009-08-29 02:27:43 +0800
commite84021944cfde5665a5286b1dbabe296a67f7231 (patch)
tree3568abc8deb98b01cddbf569e5eb1fe2484e6812
parent0f70b1bfb5714c98aa70d062b5ac7ec0e5a03dac (diff)
downloadgsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar.gz
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar.bz2
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar.lz
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar.xz
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.tar.zst
gsoc2013-empathy-e84021944cfde5665a5286b1dbabe296a67f7231.zip
Fixed bug which would occur when deleting account with pending changes
- When the selected account was NULL, accounts_dialog_has_pending_change() would not check its state correctly. That function is working with a pointer on a pointer to the account and was not dereferencing properly. - The pointer to the account we pass to accounts_dialog_has_pending_change() is now properly initialized to NULL. - When deleting an account, the COL_ACCOUNT_POINTER column is now properly set to NULL.
-rw-r--r--src/empathy-accounts-dialog.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 5e5c94756..2b233258d 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -339,7 +339,6 @@ static gboolean
accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog,
EmpathyAccount **account)
{
- gboolean has_pending_changes;
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreeSelection *selection;
@@ -350,11 +349,9 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, account, -1);
- has_pending_changes = account != NULL && priv->setting_widget_object != NULL
+ return *account != NULL && priv->setting_widget_object != NULL
&& empathy_account_widget_contains_pending_changes (
priv->setting_widget_object);
-
- return has_pending_changes;
}
static void
@@ -480,7 +477,7 @@ static void
accounts_dialog_button_add_clicked_cb (GtkWidget *button,
EmpathyAccountsDialog *dialog)
{
- EmpathyAccount *account;
+ EmpathyAccount *account = NULL;
if (accounts_dialog_has_pending_change (dialog, &account))
{
@@ -738,6 +735,7 @@ accounts_dialog_delete_account_response_cb (GtkDialog *message_dialog,
accounts_dialog_account_display_name_changed_cb, account_dialog);
empathy_account_remove_async (account, NULL, NULL);
g_object_unref (account);
+ account = NULL;
}
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
@@ -791,7 +789,10 @@ accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell,
g_free (question_dialog_primary_text);
if (account != NULL)
- g_object_unref (account);
+ {
+ g_object_unref (account);
+ account = NULL;
+ }
}
static void
@@ -936,7 +937,7 @@ accounts_dialog_account_selection_change (GtkTreeSelection *selection,
gboolean path_currently_selected,
gpointer data)
{
- EmpathyAccount *account;
+ EmpathyAccount *account = NULL;
EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (data);
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
@@ -1439,7 +1440,7 @@ accounts_dialog_response_cb (GtkWidget *widget,
gint response,
EmpathyAccountsDialog *dialog)
{
- EmpathyAccount *account;
+ EmpathyAccount *account = NULL;
if (accounts_dialog_has_pending_change (dialog, &account))
{