From 29e6c958f3e0943ced67dbe0863c427b5c2dae94 Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Mon, 20 Oct 2003 17:01:17 +0000 Subject: [PATCH] fix crash when using Forward in Filtering when external editor option is set --- ChangeLog.claws | 11 +++++++++++ configure.ac | 2 +- src/compose.c | 7 ++++--- src/compose.h | 3 ++- src/filtering.c | 48 +++++++++++------------------------------------ src/messageview.c | 2 +- 6 files changed, 30 insertions(+), 43 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index c6b3ee553..24e474f43 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,14 @@ +2003-10-20 [paul] 0.9.6claws36 + + * src/compose.[ch] + src/filtering.c + src/messageview.c + fix crash when using Forward in Filtering when + external editor option is set + + Patch submitted by Simon 'corecode' Schubert + + 2003-10-20 [paul] 0.9.6claws35 * src/pixmaps/mime_gpg_expired.xpm ** REMOVED ** diff --git a/configure.ac b/configure.ac index 383fde7ad..27e545319 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=6 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=35 +EXTRA_VERSION=36 if test $EXTRA_VERSION -eq 0; then VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws else diff --git a/src/compose.c b/src/compose.c index d21118c36..e0d81adab 100644 --- a/src/compose.c +++ b/src/compose.c @@ -882,7 +882,7 @@ void compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar *body) case COMPOSE_FORWARD_INLINE: /* check if we reply to more than one Message */ if (list_len == 1) { - compose_forward(NULL, msginfo, FALSE, body); + compose_forward(NULL, msginfo, FALSE, body, FALSE); break; } /* more messages FALL THROUGH */ @@ -1021,7 +1021,8 @@ if (msginfo->var && *msginfo->var) { \ } Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo, - gboolean as_attach, const gchar *body) + gboolean as_attach, const gchar *body, + gboolean no_extedit) { Compose *compose; GtkSText *text; @@ -1131,7 +1132,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo, #endif gtk_widget_grab_focus(compose->header_last->entry); - if (prefs_common.auto_exteditor) + if (!no_extedit && prefs_common.auto_exteditor) compose_exec_ext_editor(compose); /*save folder*/ diff --git a/src/compose.h b/src/compose.h index 7a1db31e8..c27bc8a3b 100644 --- a/src/compose.h +++ b/src/compose.h @@ -243,7 +243,8 @@ void compose_reply (MsgInfo *msginfo, Compose *compose_forward (PrefsAccount *account, MsgInfo *msginfo, gboolean as_attach, - const gchar *body); + const gchar *body, + gboolean no_extedit); Compose *compose_forward_multiple (PrefsAccount *account, GSList *msginfo_list); /* remove end */ diff --git a/src/filtering.c b/src/filtering.c index 9c623b721..853af4005 100644 --- a/src/filtering.c +++ b/src/filtering.c @@ -253,42 +253,20 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info) return TRUE; case MATCHACTION_FORWARD: - account = account_find_from_id(action->account_id); - compose = compose_forward(account, info, FALSE, NULL); - if (compose->account->protocol == A_NNTP) - compose_entry_append(compose, action->destination, - COMPOSE_NEWSGROUPS); - else - compose_entry_append(compose, action->destination, - COMPOSE_TO); - - val = compose_send(compose); - if (val == 0) { - gtk_widget_destroy(compose->window); - return TRUE; - } - - gtk_widget_destroy(compose->window); - return FALSE; - case MATCHACTION_FORWARD_AS_ATTACHMENT: - account = account_find_from_id(action->account_id); - compose = compose_forward(account, info, TRUE, NULL); - if (compose->account->protocol == A_NNTP) - compose_entry_append(compose, action->destination, - COMPOSE_NEWSGROUPS); - else - compose_entry_append(compose, action->destination, - COMPOSE_TO); + compose = compose_forward(account, info, + action->type == MATCHACTION_FORWARD ? FALSE : TRUE, + NULL, TRUE); + compose_entry_append(compose, action->destination, + compose->account->protocol == A_NNTP + ? COMPOSE_NEWSGROUPS + : COMPOSE_TO); val = compose_send(compose); - if (val == 0) { - gtk_widget_destroy(compose->window); - return TRUE; - } gtk_widget_destroy(compose->window); - return FALSE; + + return val == 0 ? TRUE : FALSE; case MATCHACTION_REDIRECT: account = account_find_from_id(action->account_id); @@ -300,13 +278,9 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info) COMPOSE_TO); val = compose_send(compose); - if (val == 0) { - gtk_widget_destroy(compose->window); - return TRUE; - } - gtk_widget_destroy(compose->window); - return FALSE; + + return val == 0 ? TRUE : FALSE; case MATCHACTION_EXECUTE: cmd = matching_build_command(action->unesc_destination, info); diff --git a/src/messageview.c b/src/messageview.c index 591756fda..c392a6ed2 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -1202,7 +1202,7 @@ static void reply_cb(gpointer data, guint action, GtkWidget *widget) } break; case COMPOSE_FORWARD_INLINE: - compose_forward(NULL, msginfo, FALSE, text); + compose_forward(NULL, msginfo, FALSE, text, FALSE); break; case COMPOSE_FORWARD_AS_ATTACH: compose_forward_multiple(NULL, mlist); -- 2.25.1