aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-07-22 00:49:32 +0800
committerMilan Crha <mcrha@redhat.com>2009-07-22 00:49:32 +0800
commita5fd4e8ffc0dadb6f62d8e670ac83c213c89b7f1 (patch)
tree2cb65f4d672348345f2d018e6c75b768ed869c91
parente730108e2078e24b878b4af53295a8058df5f3a4 (diff)
downloadgsoc2013-evolution-a5fd4e8ffc0dadb6f62d8e670ac83c213c89b7f1.tar.gz
gsoc2013-evolution-a5fd4e8ffc0dadb6f62d8e670ac83c213c89b7f1.tar.zst
gsoc2013-evolution-a5fd4e8ffc0dadb6f62d8e670ac83c213c89b7f1.zip
Bug #588787 - Crash on search in an active account or all accounts
-rw-r--r--mail/em-folder-browser.c29
-rw-r--r--mail/mail-component.c7
2 files changed, 26 insertions, 10 deletions
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 0574de0bcb..66f76c6548 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -1011,7 +1011,6 @@ struct _setup_msg {
CamelFolder *folder;
CamelOperation *cancel;
- gchar *query;
GList *sources_uri;
GList *sources_folder;
};
@@ -1033,8 +1032,6 @@ vfolder_setup_exec(struct _setup_msg *m)
d(printf("Setting up Search Folder: %s\n", m->folder->full_name));
- camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query);
-
l = m->sources_uri;
while (l) {
d(printf(" Adding uri: %s\n", (gchar *)l->data));
@@ -1077,7 +1074,6 @@ vfolder_setup_free (struct _setup_msg *m)
GList *l;
camel_object_unref(m->folder);
- g_free(m->query);
l = m->sources_uri;
while (l) {
@@ -1104,7 +1100,7 @@ static MailMsgInfo vfolder_setup_info = {
/* sources_uri should be camel uri's */
static gint
-vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList *sources_folder, CamelOperation *cancel)
+vfolder_setup (CamelFolder *folder, GList *sources_uri, GList *sources_folder, CamelOperation *cancel)
{
struct _setup_msg *m;
gint id;
@@ -1112,7 +1108,6 @@ vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList
m = mail_msg_new(&vfolder_setup_info);
m->folder = folder;
camel_object_ref(folder);
- m->query = g_strdup(query);
m->sources_uri = sources_uri;
m->sources_folder = sources_folder;
@@ -1199,14 +1194,23 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
efb->account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
/* Set the search expression */
+ camel_vee_folder_set_expression (efb->account_search_vf, search_word);
+
efb->account_search_cancel = camel_operation_new (NULL, NULL);
- vfolder_setup ((CamelFolder *)efb->account_search_vf, search_word, NULL, folder_list_account, efb->account_search_cancel);
+ vfolder_setup ((CamelFolder *)efb->account_search_vf, NULL, folder_list_account, efb->account_search_cancel);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->account_search_vf);
emfb_set_search_folder (emfv, (CamelFolder *)efb->account_search_vf, folder_uri);
g_free (folder_uri);
g_free (storeuri);
} else {
+ /* cancel previous filling first, if under way */
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
+
/* Reuse the existing search folder */
camel_vee_folder_set_expression((CamelVeeFolder *)efb->account_search_vf, search_word);
}
@@ -1281,8 +1285,10 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
l = l->next;
}
+ camel_vee_folder_set_expression (efb->all_account_search_vf, search_word);
+
efb->account_search_cancel = camel_operation_new (NULL, NULL);
- vfolder_setup ((CamelFolder *)efb->all_account_search_vf, search_word, NULL, folder_list, efb->account_search_cancel);
+ vfolder_setup ((CamelFolder *)efb->all_account_search_vf, NULL, folder_list, efb->account_search_cancel);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->all_account_search_vf);
@@ -1290,6 +1296,13 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
g_free (folder_uri);
g_free (storeuri);
} else {
+ /* cancel previous filling first, if under way */
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
+
/* Reuse the existing search folder */
camel_vee_folder_set_expression((CamelVeeFolder *)efb->all_account_search_vf, search_word);
}
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 1ad7d4d984..4e19002ca0 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -713,7 +713,10 @@ enable_folder_tree (GtkWidget *emfb, GtkWidget *emft)
/* Get the selected folder in the folder tree. */
selected_folder = em_folder_tree_get_selected_folder(EM_FOLDER_TREE (emft));
- uri = mail_tools_folder_to_url (selected_folder);
+ if (selected_folder)
+ uri = mail_tools_folder_to_url (selected_folder);
+ else
+ uri = NULL;
selected_curl = uri ? camel_url_new (uri, NULL) : NULL;
@@ -1628,7 +1631,7 @@ mail_component_show_logger (gpointer top)
void
mail_component_show_status_bar (gboolean show)
{
- MailComponent *mc = mail_component_peek ();
+ /*MailComponent *mc = mail_component_peek ();*/
/* Nothing to do */
return;