diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-06-07 05:09:20 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-06-07 05:09:20 +0800 |
commit | f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a (patch) | |
tree | 24e03835f0e3216ded55b1b248efbb530367f75a /mail | |
parent | c77b7e30202573c1c4ab54086388202d93181b45 (diff) | |
download | gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar.gz gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar.bz2 gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar.lz gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar.xz gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.tar.zst gsoc2013-evolution-f15bb6a3ebcadfc4dbe8e9d2a2c82c98ac2da35a.zip |
Check that the chain of deferences in gui->account->source->url is safe.
2001-06-06 Jon Trowbridge <trow@ximian.com>
* mail-account-gui.c (source_type_changed): Check that the chain
of deferences in gui->account->source->url is safe. This was
causing a segfault when adding a new account if any of the
existing accounts had their sources set to "None".
(i.e. gui->account->source == NULL)
* mail-accounts.c (load_accounts): Check that account->source !=
NULL before dereferencing it.
(load_accounts): The selection is cleared when the account clist
is rebuilt (say after a call to add), but no unselect event is
emitted. Yes, the clist is evil. We work around this by
explictly calling mail_unselect, our unselect signal handler.
(Otherwise, the edit and delete buttons remain sensitive and
accounts_row != 0, but the user can't see which row the dialog
thinks is selected.)
(load_news): Check the account->source != NULL before
dereferencing it.
(mail_unselect): If an insensitive button in a button box has the
focus, and if you hit tab, there is a segfault deep inside of gtk.
This is probably a gtk bug. We work around it by having the add
button (which is always sensitive) grab the focus on an unselect.
svn path=/trunk/; revision=10136
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 24 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 9 | ||||
-rw-r--r-- | mail/mail-accounts.c | 20 |
3 files changed, 48 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index cc5a2008ce..5cf9910a36 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,27 @@ +2001-06-06 Jon Trowbridge <trow@ximian.com> + + * mail-account-gui.c (source_type_changed): Check that the chain + of deferences in gui->account->source->url is safe. This was + causing a segfault when adding a new account if any of the + existing accounts had their sources set to "None". + (i.e. gui->account->source == NULL) + + * mail-accounts.c (load_accounts): Check that account->source != + NULL before dereferencing it. + (load_accounts): The selection is cleared when the account clist + is rebuilt (say after a call to add), but no unselect event is + emitted. Yes, the clist is evil. We work around this by + explictly calling mail_unselect, our unselect signal handler. + (Otherwise, the edit and delete buttons remain sensitive and + accounts_row != 0, but the user can't see which row the dialog + thinks is selected.) + (load_news): Check the account->source != NULL before + dereferencing it. + (mail_unselect): If an insensitive button in a button box has the + focus, and if you hit tab, there is a segfault deep inside of gtk. + This is probably a gtk bug. We work around it by having the add + button (which is always sensitive) grab the focus on an unselect. + 2001-06-05 Jason Leach <jleach@ximian.com> (Fix bug #3211: Should undelete when flagging a delete message as diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 74150adace..557bc49817 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -184,7 +184,7 @@ source_type_changed (GtkWidget *widget, gpointer user_data) MailAccountGui *gui = user_data; GtkWidget *label, *frame, *dwidget = NULL; CamelProvider *provider; - + provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); gui->source.provider = provider; @@ -195,6 +195,7 @@ source_type_changed (GtkWidget *widget, gpointer user_data) /* hostname */ label = glade_xml_get_widget (gui->xml, "source_host_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { dwidget = GTK_WIDGET (gui->source.hostname); gtk_widget_show (GTK_WIDGET (gui->source.hostname)); @@ -206,6 +207,7 @@ source_type_changed (GtkWidget *widget, gpointer user_data) /* username */ label = glade_xml_get_widget (gui->xml, "source_user_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { if (!dwidget) dwidget = GTK_WIDGET (gui->source.username); @@ -218,6 +220,7 @@ source_type_changed (GtkWidget *widget, gpointer user_data) /* path */ label = glade_xml_get_widget (gui->xml, "source_path_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH)) { if (!dwidget) dwidget = GTK_WIDGET (gui->source.path); @@ -271,8 +274,8 @@ source_type_changed (GtkWidget *widget, gpointer user_data) if (dwidget) gtk_widget_grab_focus (dwidget); - - mail_account_gui_build_extra_conf (gui, gui->account->source->url); + + mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL); } diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 78317336cd..47dc311107 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -40,6 +40,8 @@ static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class); static void mail_accounts_dialog_init (MailAccountsDialog *dialog); static void mail_accounts_dialog_finalise (GtkObject *obj); +static void mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data); + static GnomeDialogClass *parent_class; @@ -111,7 +113,7 @@ load_accounts (MailAccountsDialog *dialog) account = node->data; - if (account->source->url) + if (account->source && account->source->url) url = camel_url_new (account->source->url, NULL); else url = NULL; @@ -135,6 +137,13 @@ load_accounts (MailAccountsDialog *dialog) } gtk_clist_thaw (dialog->mail_accounts); + + /* + * The selection gets cleared when we rebuild the clist, but no + * unselect event is emitted. So we simulate it here. + * I hate the clist. + */ + mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog); } #ifdef ENABLE_NNTP @@ -155,7 +164,7 @@ load_news (MailAccountsDialog *dialog) account = node->data; - if (account->source->url) + if (account->source && account->source->url) url = camel_url_new (account->source->url, NULL); else url = NULL; @@ -210,6 +219,13 @@ mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gp gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); + + /* + * If an insensitive button in a button box has the focus, and if you hit tab, + * there is a segfault. I think that this might be a gtk bug. Anyway, this + * is a workaround. + */ + gtk_widget_grab_focus (GTK_WIDGET (dialog->mail_add)); } static void |