Comment 81 for bug 95507

Revision history for this message
In , Karlt (karlt) wrote :

(In reply to comment #59)
> (In reply to comment #57)
> > The destination app should not indicate that it is finished until it has
> > copied the file. This seems to be implied by both the XDND and Motif
> > protocols:
> Right, unfortunately the KDE applications have a bug there (well, it is
> actually a bug/missing feature in Qt) and they return the XDNDFinished signal
> too early before they have started copying the file. I talked with the
> Qt developers already, however it won't be fixed in near future, therefor
> that delayed deleting would be a helpfull workaround.
> (See last entry on http://www.freedesktop.org/wiki/Specifications/XDNDRevision)
>
> > We don't really want to keep accumulating these files when the application
> > runs for months and the files would not be cleaned up if the app doesn't get a
> > chance to shut down nicely.
> Is it so common that a Thunderbird app runs for months?

I assume mail apps tend to get run continuously (rather than started and quit
repeatedly) so that users are notified of new mail, so I hope Thunderbird will
run for months.

I don't know but I wonder whether or not the app shuts down cleanly when the X
session is ended.

This could be used by any app of unknown function too.

I think deleting the file on a timer could be suitable workaround. (It would
still need to be deleted on exit as well, assuming the timer is not guaranteed
to run before exit.)

Either a glib timer (g_timeout_add? - beware we need to support glib-2.12.x) or
nsITimer should be helpful.
http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/nsITimer.idl

Once the destination has a file handle, it should be safe to unlink, but it
could take a little while for the destination to get a file handle if it
prompts the user for anything. I guess a timeout of a few minutes should be
suitable.