From 909bdc093cfe9af816b17829ee0ca73da09d02a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 8 Apr 2004 00:06:43 +0000 Subject: Check that emft_selection_get_selected() returns TRUE before we try to use 2004-04-07 Jeffrey Stedfast * em-folder-tree.c (emft_tree_button_press): Check that emft_selection_get_selected() returns TRUE before we try to use the iter. Fixes bug #56652. (emft_popup_delete_response): Same idea here. (emft_popup_delete_folder): Same. (emft_popup_rename_folder): Same. (emft_popup_properties): Same. svn path=/trunk/; revision=25366 --- mail/ChangeLog | 8 ++++++++ mail/em-folder-tree.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 135cbb614a..2b90eb8889 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,13 @@ 2004-04-07 Jeffrey Stedfast + * em-folder-tree.c (emft_tree_button_press): Check that + emft_selection_get_selected() returns TRUE before we try to use + the iter. Fixes bug #56652. + (emft_popup_delete_response): Same idea here. + (emft_popup_delete_folder): Same. + (emft_popup_rename_folder): Same. + (emft_popup_properties): Same. + Fix for bug #56538 * em-folder-view.c (emfv_set_folder_uri): Don't set the preview diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 585abaf10a..102c87b65d 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2339,7 +2339,9 @@ emft_popup_delete_response (GtkWidget *dialog, guint response, EMFolderTree *emf return; selection = gtk_tree_view_get_selection (priv->treeview); - emft_selection_get_selected (selection, &model, &iter); + if (!emft_selection_get_selected (selection, &model, &iter)) + return; + gtk_tree_model_get (model, &iter, COL_STRING_FOLDER_PATH, &path, COL_POINTER_CAMEL_STORE, &store, -1); @@ -2364,7 +2366,9 @@ emft_popup_delete_folder (GtkWidget *item, EMFolderTree *emft) char *title, *path; selection = gtk_tree_view_get_selection (priv->treeview); - emft_selection_get_selected (selection, &model, &iter); + if (!emft_selection_get_selected (selection, &model, &iter)) + return; + gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_FOLDER_PATH, &path, -1); local = mail_component_peek_local_store (NULL); @@ -2411,7 +2415,9 @@ emft_popup_rename_folder (GtkWidget *item, EMFolderTree *emft) local = mail_component_peek_local_store (NULL); selection = gtk_tree_view_get_selection (priv->treeview); - emft_selection_get_selected (selection, &model, &iter); + if (!emft_selection_get_selected (selection, &model, &iter)) + return; + gtk_tree_model_get (model, &iter, COL_STRING_FOLDER_PATH, &folder_path, COL_STRING_DISPLAY_NAME, &name, COL_POINTER_CAMEL_STORE, &store, @@ -2494,7 +2500,9 @@ emft_popup_properties (GtkWidget *item, EMFolderTree *emft) char *uri; selection = gtk_tree_view_get_selection (priv->treeview); - emft_selection_get_selected (selection, &model, &iter); + if (!emft_selection_get_selected (selection, &model, &iter)) + return; + gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1); em_folder_properties_show(NULL, NULL, uri); @@ -2559,7 +2567,9 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr /* FIXME: we really need the folderinfo to build a proper menu */ selection = gtk_tree_view_get_selection (treeview); - emft_selection_get_selected (selection, &model, &iter); + if (!emft_selection_get_selected (selection, &model, &iter)) + return FALSE; + gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_URI, &uri, COL_STRING_FOLDER_PATH, &path, COL_BOOL_IS_STORE, &isstore, -1); -- cgit v1.2.3