[evolution/wip/gsettings] Bug #633982 - Crash when trying to Create a search folder from a search



commit 2e68a6a74d19d4cda574fd09fd2cbf951a21916d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 19 12:10:56 2011 +0100

    Bug #633982 - Crash when trying to Create a search folder from a search

 mail/mail-vfolder.c                      |    4 +---
 mail/mail-vfolder.h                      |    3 ++-
 modules/mail/e-mail-shell-view-actions.c |    4 +++-
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 89716ff..7f22198 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1347,13 +1347,11 @@ vfolder_create_part (const gchar *name)
 
 /* clones a filter/search rule into a matching vfolder rule (assuming the same system definitions) */
 EFilterRule *
-vfolder_clone_rule (EFilterRule *in)
+vfolder_clone_rule (EMailSession *session, EFilterRule *in)
 {
-	EMailSession *session;
 	EFilterRule *rule;
 	xmlNodePtr xml;
 
-	session = em_vfolder_rule_get_session (EM_VFOLDER_RULE (in));
 	rule = em_vfolder_rule_new (session);
 
 	xml = e_filter_rule_xml_encode (in);
diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h
index 19c4d52..91aae4d 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -36,7 +36,8 @@ void		vfolder_edit			(EShellView *shell_view);
 void		vfolder_edit_rule		(EMailBackend *backend,
 						 const gchar *name);
 EFilterPart *	vfolder_create_part		(const gchar *name);
-EFilterRule *	vfolder_clone_rule		(EFilterRule *in);
+EFilterRule *	vfolder_clone_rule		(EMailSession *session,
+						 EFilterRule *in);
 void		vfolder_gui_add_rule		(EMVFolderRule *rule);
 void		vfolder_gui_add_from_message	(EMailSession *session,
 						 CamelMimeMessage *msg,
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 0852180..04f8dcb 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -157,7 +157,9 @@ action_mail_create_search_folder_cb (GtkAction *action,
 	reader = E_MAIL_READER (mail_view);
 	folder_uri = e_mail_reader_get_folder_uri (reader);
 
-	search_rule = vfolder_clone_rule (search_rule);
+	search_rule = vfolder_clone_rule (session, search_rule);
+	g_return_if_fail (search_rule != NULL);
+
 	rule_name = g_strdup_printf ("%s %s", search_rule->name, search_text);
 	e_filter_rule_set_source (search_rule, E_FILTER_SOURCE_INCOMING);
 	e_filter_rule_set_name (search_rule, rule_name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]