diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-10-19 10:24:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-10-19 13:09:35 +0200 |
commit | c33607813ad0c4de69d20b98ba6146f319443d66 (patch) | |
tree | a2a19ebd029ee2d0b33b57c9c7613402e3412f26 /unotools | |
parent | e74d0f01504c61917d8ff9e7538a0017b6212ff5 (diff) |
crashtesting: temp files accumulating over time
Change-Id: I922ba92d0a9278b366b4bec38170a776830c1682
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141525
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index af58473b9b87..406f08130dbd 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -368,6 +368,7 @@ TempFileFast::TempFileFast(TempFileFast && other) noexcept : TempFileFast::~TempFileFast() { + CloseStream(); } SvStream* TempFileFast::GetStream( StreamMode eMode ) @@ -382,7 +383,13 @@ SvStream* TempFileFast::GetStream( StreamMode eMode ) void TempFileFast::CloseStream() { - mxStream.reset(); + if (mxStream) + { + OUString aName = mxStream->GetFileName(); + mxStream.reset(); + if (!aName.isEmpty() && (osl::FileBase::getFileURLFromSystemPath(aName, aName) == osl::FileBase::E_None)) + File::remove(aName); + } } OUString CreateTempURL( const OUString* pParent, bool bDirectory ) |