Rocco Rutte:
[apps/madmutt.git] / compose.c
index 377d60e..aacfd8d 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -801,6 +801,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           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++);
@@ -954,6 +955,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
 
     case OP_DELETE:
       CHECK_COUNT;
+      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);
@@ -1278,6 +1281,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           /* avoid freeing other attachments */
           idx[idxlen]->content->next = NULL;
           idx[idxlen]->content->parts = NULL;
+          if (idx[idxlen]->unowned)
+            idx[idxlen]->content->unlink = 0;
           mutt_free_body (&idx[idxlen]->content);
           FREE (&idx[idxlen]->tree);
           FREE (&idx[idxlen]);