Hi Kevin,

> Date: 2026-08-25 18:00:25+0800
> From: "Kevin J. McCarthy" <[email protected]>
>
> The files are copied to $tmpdraftdir, and are "owned" by the compose
> process.  But they still had their unowned flag set.  So aborting the
> compose would leave those files inside $tmpdraftdir.
> 
> Unset the flag so they are properly cleaned up.
> ---
>  compose.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/compose.c b/compose.c
> index 5cf1e31b..604cd185 100644
> --- a/compose.c
> +++ b/compose.c
> @@ -1575,16 +1575,19 @@ int mutt_compose_menu(SEND_CONTEXT *sctx)
>          CHECK_COUNT;
>          if (menu->tagprefix)
>          {
> -          BODY *top;
> -          for (top = msg->content; top; top = top->next)
> -          {
> -            if (top->tagged)
> -              mutt_get_tmp_attachment(top);
> -          }
> +          for (i = 0; i < actx->idxlen; i++)
> +            if (actx->idx[i]->content->tagged &&
> +                (mutt_get_tmp_attachment(actx->idx[i]->content) == 0))
> +            {
> +              actx->idx[i]->unowned = 0;
> +            }

This for loop feels quite weird (due to braces).  How about reversing
one condition to split them?

        for (i = 0; i < actx->idxlen; i++)
        {
          if (!actx->idx[i]->content->tagged)
            continue;
          if (mutt_get_tmp_attachment(actx->idx[i]->content) == 0)
            actx->idx[i]->unowned = 0;
        }


Have a lovely day!
Alex

>            menu->redraw = REDRAW_FULL;
>          }
>          else if (mutt_get_tmp_attachment(CURATTACH->content) == 0)
> +        {
> +          CURATTACH->unowned = 0;
>            menu->redraw = REDRAW_CURRENT;
> +        }
>  
>          /* No send2hook since this doesn't change the message. */
>          break;
> -- 
> 2.55.0
> 

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to