[Commits] [SCM] claws branch, master, updated. 3.9.3-219-g6086f18

colin at claws-mail.org colin at claws-mail.org
Thu May 22 22:12:03 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  6086f18b8586d0cf6fdcec0ed33809ae8636b3ec (commit)
      from  61e19ee9a509f9c4535a0dfb21a08faffb05f079 (commit)


- Log -----------------------------------------------------------------
commit 6086f18b8586d0cf6fdcec0ed33809ae8636b3ec
Author: Colin Leroy <colin at colino.net>
Date:   Thu May 22 22:11:07 2014 +0200

    Fix bug #2447, "Compose window crashes if moving a folder that is being replied to". Also constify compose_get_compose_list()

diff --git a/src/compose.c b/src/compose.c
index 5da0cc0..d0123db 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -763,8 +763,8 @@ static GtkTargetEntry compose_mime_types[] =
 
 static gboolean compose_put_existing_to_front(MsgInfo *info)
 {
-	GList *compose_list = compose_get_compose_list();
-	GList *elem = NULL;
+	const GList *compose_list = compose_get_compose_list();
+	const GList *elem = NULL;
 	
 	if (compose_list) {
 		for (elem = compose_list; elem != NULL && elem->data != NULL; 
@@ -2535,7 +2535,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 	return compose;
 }
 
-GList *compose_get_compose_list(void)
+const GList *compose_get_compose_list(void)
 {
 	return compose_list;
 }
@@ -11803,6 +11803,33 @@ static void compose_subject_entry_activated(GtkWidget *widget, gpointer data)
 	gtk_widget_grab_focus(compose->text);
 }
 
+void compose_list_update_folders(FolderItem *old_item, FolderItem *new_item)
+{
+	const GList *compose_list = compose_get_compose_list();
+	const GList *elem = NULL;
+	
+	if (compose_list) {
+		for (elem = compose_list; elem != NULL && elem->data != NULL; 
+		     elem = elem->next) {
+			Compose *c = (Compose*)elem->data;
+
+			if (c->targetinfo && c->targetinfo->folder == old_item)
+				c->targetinfo->folder = new_item;
+
+			if (c->replyinfo && c->replyinfo->folder == old_item)
+				c->replyinfo->folder = new_item;
+
+			if (c->fwdinfo && c->fwdinfo->folder == old_item)
+				c->fwdinfo->folder = new_item;
+
+			if (c->autosaved_draft && c->autosaved_draft->folder == old_item)
+				c->autosaved_draft->folder = new_item;
+
+		}
+	}
+}
+
+
 /*
  * End of Source.
  */
diff --git a/src/compose.h b/src/compose.h
index a475110..b7eb416 100644
--- a/src/compose.h
+++ b/src/compose.h
@@ -297,7 +297,7 @@ Compose *compose_redirect		(PrefsAccount	*account,
 Compose *compose_reedit			(MsgInfo	*msginfo,
 					 gboolean	 batch);
 
-GList *compose_get_compose_list		(void);
+const GList *compose_get_compose_list	(void);
 
 void compose_entry_append		(Compose	  *compose,
 					 const gchar	  *address,
@@ -342,4 +342,6 @@ void compose_clear_exit_drafts		(void);
 void compose_reopen_exit_drafts		(void);
 void compose_attach_from_list (Compose *compose, GList *file_list, gboolean free_data);
 void compose_check_for_email_account(Compose *compose);
+void compose_list_update_folders(FolderItem *old_item, FolderItem *new_item);
+
 #endif /* __COMPOSE_H__ */
diff --git a/src/folder.c b/src/folder.c
index 1bd7d98..52fc192 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -431,7 +431,8 @@ void folder_item_remove(FolderItem *item)
 			folder_item_remove(sub_item);
 		}
 	}
-	
+
+	compose_list_update_folders(item, NULL);
 	/* remove myself */
 	if (item->cache != NULL) {
 		msgcache_destroy(item->cache);
@@ -3292,6 +3293,8 @@ static FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest,
 	old_id = folder_item_get_identifier(src);
 	new_id = folder_item_get_identifier(new_item);
 
+	compose_list_update_folders(src, new_item);
+
 	/* if src supports removing, otherwise only copy folder */
 	if (src->folder->klass->remove_folder != NULL && !copy)	
 		src->folder->klass->remove_folder(src->folder, src);
diff --git a/src/main.c b/src/main.c
index 26c7e18..41d49cf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2026,7 +2026,7 @@ static void initial_processing(FolderItem *item, gpointer data)
 
 static gboolean draft_all_messages(void)
 {
-	GList *compose_list = NULL;
+	const GList *compose_list = NULL;
 	
 	compose_clear_exit_drafts();
 	compose_list = compose_get_compose_list();
diff --git a/src/prefs_actions.c b/src/prefs_actions.c
index 673d9b5..030a66d 100644
--- a/src/prefs_actions.c
+++ b/src/prefs_actions.c
@@ -920,8 +920,8 @@ static void prefs_actions_cancel(GtkWidget *w, gpointer data)
 static void prefs_actions_ok(GtkWidget *widget, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *) data;
-	GList *list;
-	GList *iter;
+	const GList *list;
+	const GList *iter;
 	MessageView *msgview;
 	Compose *compose;
 	GtkListStore *store;
diff --git a/src/toolbar.c b/src/toolbar.c
index 8588d51..0f79780 100644
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -983,8 +983,8 @@ void toolbar_set_learn_button(Toolbar            *toolbar,
 void toolbar_toggle(guint action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow*)data;
-	GList *list;
-	GList *cur;
+	const GList *list;
+	const GList *cur;
 
 	cm_return_if_fail(mainwin != NULL);
 

-----------------------------------------------------------------------

Summary of changes:
 src/compose.c       |   33 ++++++++++++++++++++++++++++++---
 src/compose.h       |    4 +++-
 src/folder.c        |    5 ++++-
 src/main.c          |    2 +-
 src/prefs_actions.c |    4 ++--
 src/toolbar.c       |    4 ++--
 6 files changed, 42 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list