On Tuesday, 02 August 2005 at 00:18, Brendan Cully wrote: > On Tuesday, 02 August 2005 at 09:12, Thomas Roessler wrote: > > > * compose.c: Don't unlink attachments that you've decided > > > not to send. (closes #1328) > > > > +++ compose.c 2 Aug 2005 01:13:25 -0000 3.23 > > @@ -814,6 +814,7 @@ > > > > case OP_DELETE: > > CHECK_COUNT; > > + idx[menu->current]->content->unlink = 0; > > if (delete_attachment (menu, &idxlen, menu->current) == -1) > > break; > > mutt_update_tree (idx, idxlen); > > > > > > This will leak temporary files generated by mutt when somebody > > deletes, e.g., the body. I would prefer to back out this change. > > Alright. I guess the thing to do is to add another bit of state to the > entry, marking whether or not mutt owns the file? How's this?
Index: compose.c
===================================================================
RCS file: /home/roessler/cvs/mutt/compose.c,v
retrieving revision 3.23
diff -u -p -r3.23 compose.c
--- compose.c 2 Aug 2005 01:13:25 -0000 3.23
+++ compose.c 2 Aug 2005 07:28:54 -0000
@@ -686,6 +686,7 @@ int mutt_compose_menu (HEADER *msg, /*
{
char *att = files[i];
idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
+ idx[idxlen]->unowned = 1;
idx[idxlen]->content = mutt_make_file_attach (att);
if (idx[idxlen]->content != NULL)
update_idx (menu, idx, idxlen++);
@@ -814,7 +815,8 @@ int mutt_compose_menu (HEADER *msg, /*
case OP_DELETE:
CHECK_COUNT;
- idx[menu->current]->content->unlink = 0;
+ if (idx[menu->current]->unowned)
+ idx[menu->current]->content->unlink = 0;
if (delete_attachment (menu, &idxlen, menu->current) == -1)
break;
mutt_update_tree (idx, idxlen);
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.45
diff -u -p -r3.45 mutt.h
--- mutt.h 1 Aug 2005 07:35:04 -0000 3.45
+++ mutt.h 2 Aug 2005 07:28:55 -0000
@@ -855,6 +855,7 @@ typedef struct attachptr
char *tree;
int level;
int num;
+ unsigned int unowned : 1; /* don't unlink on detach */
} ATTACHPTR;
typedef struct
Attachment:
pgpwAw823jqSm.pgp
Description: PGP signature