Mail.app doesn't release attached files after they've been sent

Originator:igeek1
Number:rdar://10117918 Date Originated:13 September 2011
Status:Duplicate of 4023875 Resolved:16-Sep-2011 08:29
Product:Mail Product Version:5.0 (1244.2/1244.3)
Classification:Serious Bug Reproducible:always
 
Summary: when you attach a file to an email in Mail, Mail doesn't close the file after sending the email.

Steps to Reproduce:

1. open Mail.app.
2. Create a new email message with Command-N.
3. Attach a file, either through drag-and-drop or with the toolbar attachment button.
4. Send the email.
5. After the email has sent, put the file that you attached in the Dock's Trash (I did it using Command-delete).
6. Empty the trash.

Expected Results:
Since the email has already sent, Mail shouldn't need to keep the file open. The Trash should empty normally.

Actual Results:
Emptying the Trash fails with the message "The operation can't be completed because the item <filename> is in use."

To make sure it really is Mail using the file, I ran the following command: 
lsof | grep .Trash
This returns the results:
igeek@zevasaurus-rex:: lsof | grep .Trash                                                                                                   [~]
Finder      221 igeek   18r     DIR               14,2       102 20440784 /Users/igeek/.Trash
Mail      36486 igeek  txt      REG               14,2    734068 20769178 /Users/igeek/.Trash/Screen Shot 2011-09-13 at 3.51.25 PM.png

Quitting Mail.app allows the trash to be emptied normally.

Regression:
problem exists in Mac OS X version 10.6.8 as well as 10.7.1.

Notes:

Comments

As duplicate of which issue?

I guess it's this one: http://openradar.appspot.com/radar?id=1147402 (i.e. original ID 5876218), but it's always more helpful to post the original IDs for duplicate issues on openRadar.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!