This patch "fixes" the segfault by reverting to the old behavior of using mutt_save_attachment() for the compose/send case when viewing text attachments in the pager.
Whether this is the correct thing to do is another discussion. Hopefully someone more knowledgeable will chime in. -Kevin
# HG changeset patch # User Kevin McCarthy <ke...@8t8.us> # Date 1374012414 25200 # Branch HEAD # Node ID d762a618897def1a5e3163a686a7beda75d47743 # Parent d3096e8796e7fcbd7ed507b7502029c7f73f159e Fix segfault when viewing text attachments in compose menu. (closes #3644) The segfault was introduced in changeset b9f9e3147eb4. Since decoding and charset conversion aren't needed for attachments when composing a message, this patch reverts to just using mutt_save_attachment() to view "raw data" for text attachments in the compose/send case. diff --git a/attach.c b/attach.c --- a/attach.c +++ b/attach.c @@ -497,17 +497,17 @@ (entry->needsterminal && option (OPTWAITKEY))) mutt_any_key_to_continue (NULL); } } else { /* Don't use mailcap; the attachment is viewed in the pager */ - if (flag == M_AS_TEXT) + if ((flag == M_AS_TEXT) && fp) { /* just let me see the raw data. * * Don't use mutt_save_attachment() because we want to perform charset * conversion since this will be displayed by the internal pager. */ STATE decode_state; @@ -521,16 +521,22 @@ goto return_error; } decode_state.fpin = fp; decode_state.flags = M_CHARCONV; mutt_decode_attachment(a, &decode_state); if (fclose(decode_state.fpout) == EOF) dprint(1, (debugfile, "mutt_view_attachment:%d fclose errno=%d %s\n", __LINE__, pagerfile, errno, strerror(errno))); } + else if (flag == M_AS_TEXT) + { + /* for the send case, just let me see the raw data */ + if (mutt_save_attachment (fp, a, pagerfile, 0, NULL)) + goto return_error; + } else { /* Use built-in handler */ set_option (OPTVIEWATTACH); /* disable the "use 'v' to view this part" * message in case of error */ if (mutt_decode_save_attachment (fp, a, pagerfile, M_DISPLAY, 0)) { unset_option (OPTVIEWATTACH);
signature.asc
Description: Digital signature