This topic describes how a temporary file can be destroyed automatically when the owning thread closes it or if the owning thread crashes.
Set EDeleteOnClose when opening a temporary file to enable the automatic deletion on closure. EDeleteOnClose can be used with RFile::Temp() and RFile::Create(). For example:
r = file.Create(TheFs, filename, EFileShareAny | EFileRead | EFileWrite | EDeleteOnClose);
The purpose of this flag is to prevent memory leaks when components that create temporary files crash.