aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-01-23 22:24:09 +0800
committerMilan Crha <mcrha@redhat.com>2013-01-23 22:25:02 +0800
commitfe8e579347a081c6b4bba79430b8c95054bf1280 (patch)
treed80138e50533433b61285a8df6c9bd05ab5fe106
parent4fb610b4893895b1659ab7c95e0e59784b0d020c (diff)
downloadgsoc2013-evolution-fe8e579347a081c6b4bba79430b8c95054bf1280.tar.gz
gsoc2013-evolution-fe8e579347a081c6b4bba79430b8c95054bf1280.tar.zst
gsoc2013-evolution-fe8e579347a081c6b4bba79430b8c95054bf1280.zip
Bug #639698 - Crash in mail_shell_view_execute_search()
-rw-r--r--modules/mail/e-mail-shell-view.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 548be0bd97..f739ca6660 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -545,8 +545,8 @@ all_accounts:
* account-wide searches still in progress. */
text = e_shell_searchbar_get_search_text (searchbar);
if (text == NULL || *text == '\0') {
- CamelStore *selected_store;
- gchar *selected_folder_name;
+ CamelStore *selected_store = NULL;
+ gchar *selected_folder_name = NULL;
if (priv->search_account_all != NULL) {
g_object_unref (priv->search_account_all);
@@ -564,13 +564,17 @@ all_accounts:
* avoid search conflicts, so we can't just grab the
* folder URI and let the asynchronous callbacks run
* after we've already kicked off the search. */
- em_folder_tree_get_selected (
- folder_tree, &selected_store, &selected_folder_name);
- folder = camel_store_get_folder_sync (
- selected_store, selected_folder_name,
- CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
- e_mail_reader_set_folder (reader, folder);
- g_object_unref (selected_store);
+ if (em_folder_tree_get_selected (folder_tree, &selected_store, &selected_folder_name) &&
+ selected_store && selected_folder_name) {
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
+ e_mail_reader_set_folder (reader, folder);
+ g_object_unref (folder);
+ }
+
+ if (selected_store)
+ g_object_unref (selected_store);
g_free (selected_folder_name);
gtk_widget_set_sensitive (GTK_WIDGET (combo_box), TRUE);
@@ -609,7 +613,7 @@ all_accounts:
camel_service_connect_sync (service, NULL, NULL);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
- CAMEL_STORE (service), _("All Account Search"), 0);
+ CAMEL_STORE (service), _("All Account Search"), CAMEL_STORE_FOLDER_PRIVATE);
priv->search_account_all = search_folder;
g_object_unref (service);
@@ -642,8 +646,8 @@ current_account:
* account-wide searches still in progress. */
text = e_shell_searchbar_get_search_text (searchbar);
if (text == NULL || *text == '\0') {
- CamelStore *selected_store;
- gchar *selected_folder_name;
+ CamelStore *selected_store = NULL;
+ gchar *selected_folder_name = NULL;
if (priv->search_account_current != NULL) {
g_object_unref (priv->search_account_current);
@@ -661,13 +665,17 @@ current_account:
* avoid search conflicts, so we can't just grab the
* folder URI and let the asynchronous callbacks run
* after we've already kicked off the search. */
- em_folder_tree_get_selected (
- folder_tree, &selected_store, &selected_folder_name);
- folder = camel_store_get_folder_sync (
- selected_store, selected_folder_name,
- CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
- e_mail_reader_set_folder (reader, folder);
- g_object_unref (selected_store);
+ if (em_folder_tree_get_selected (folder_tree, &selected_store, &selected_folder_name) &&
+ selected_store && selected_folder_name) {
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
+ e_mail_reader_set_folder (reader, folder);
+ g_object_unref (folder);
+ }
+
+ if (selected_store)
+ g_object_unref (selected_store);
g_free (selected_folder_name);
gtk_widget_set_sensitive (GTK_WIDGET (combo_box), TRUE);
@@ -706,7 +714,7 @@ current_account:
camel_service_connect_sync (service, NULL, NULL);
search_folder = (CamelVeeFolder *) camel_vee_folder_new (
- CAMEL_STORE (service), _("Account Search"), 0);
+ CAMEL_STORE (service), _("Account Search"), CAMEL_STORE_FOLDER_PRIVATE);
priv->search_account_current = search_folder;
g_object_unref (service);