summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-05 23:26:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-08-07 07:53:18 +0000
commitef698035aa2aa64fc4c4455b394e6782772fef4f (patch)
treee75853035e60af5cc5634ef776249dee37f24b7c /package
parent745c7bce5fe8b218f7d300667a5409bc7ef58c34 (diff)
Related: tdf#88314 delete temp files
clear to close the inputstream before attempting to delete the temp file, which is plausible as the windows-specific failure in earlier attempts at this Change-Id: I751aa3a098dd960f56b77a5f5fc93783c1060556 Reviewed-on: https://gerrit.libreoffice.org/17531 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipOutputEntry.hxx1
-rw-r--r--package/source/zipapi/ZipOutputEntry.cxx7
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx2
3 files changed, 10 insertions, 0 deletions
diff --git a/package/inc/ZipOutputEntry.hxx b/package/inc/ZipOutputEntry.hxx
index d431a0746ea7..3a6447cc9007 100644
--- a/package/inc/ZipOutputEntry.hxx
+++ b/package/inc/ZipOutputEntry.hxx
@@ -69,6 +69,7 @@ public:
css::uno::Reference< css::io::XInputStream > getData() const;
::css::uno::Any getParallelDeflateException() const { return m_aParallelDeflateException; }
void closeBufferFile();
+ void deleteBufferFile();
ZipEntry* getZipEntry() { return m_pCurrentEntry; }
ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; }
diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx
index e3070036fa31..47ecbb4622af 100644
--- a/package/source/zipapi/ZipOutputEntry.cxx
+++ b/package/source/zipapi/ZipOutputEntry.cxx
@@ -114,6 +114,13 @@ void ZipOutputEntry::closeBufferFile()
m_xOutStream.clear();
}
+void ZipOutputEntry::deleteBufferFile()
+{
+ assert(!m_xOutStream.is() && !m_aTempURL.isEmpty());
+ uno::Reference < ucb::XSimpleFileAccess3 > xAccess(ucb::SimpleFileAccess::create(m_xContext));
+ xAccess->kill(m_aTempURL);
+}
+
uno::Reference< io::XInputStream > ZipOutputEntry::getData() const
{
uno::Reference < ucb::XSimpleFileAccess3 > xTempAccess(ucb::SimpleFileAccess::create(m_xContext));
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 4acfa77f0124..be261cd5bef9 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -121,10 +121,12 @@ void ZipOutputStream::finish()
rawWrite(aSequence);
}
while (nRead == n_ConstBufferSize);
+ xInput.clear();
rawCloseEntry(m_aEntries[i]->isEncrypt());
m_aEntries[i]->getZipPackageStream()->successfullyWritten(m_aEntries[i]->getZipEntry());
+ m_aEntries[i]->deleteBufferFile();
delete m_aEntries[i];
}