diff options
-rw-r--r-- | package/inc/ZipOutputStream.hxx | 1 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputStream.cxx | 12 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 11 |
3 files changed, 23 insertions, 1 deletions
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx index 26d7715c05b9..136bc72b249d 100644 --- a/package/inc/ZipOutputStream.hxx +++ b/package/inc/ZipOutputStream.hxx @@ -40,6 +40,7 @@ class ZipOutputStream ZipEntry *m_pCurrentEntry; comphelper::ThreadPool &m_rSharedThreadPool; std::vector< ZipOutputEntry* > m_aEntries; + ::css::uno::Any m_aDeflateException; public: ZipOutputStream( diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 9213ed7c586b..2daff01fc1c2 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -98,7 +98,12 @@ void ZipOutputStream::consumeScheduledThreadEntry(ZipOutputEntry* pCandidate) //Any exceptions thrown in the threads were caught and stored for now ::css::uno::Any aCaughtException(pCandidate->getParallelDeflateException()); if (aCaughtException.hasValue()) - ::cppu::throwException(aCaughtException); + { + m_aDeflateException = aCaughtException; // store it for later throwing + // the exception handler in DeflateThread should have cleaned temp file + delete pCandidate; + return; + } writeLOC(pCandidate->getZipEntry(), pCandidate->isEncrypt()); @@ -178,6 +183,11 @@ void ZipOutputStream::finish() // consume all processed entries consumeAllScheduledThreadEntries(); + if (m_aDeflateException.hasValue()) + { // throw once all threads are finished and m_aEntries can be released + ::cppu::throwException(m_aDeflateException); + } + sal_Int32 nOffset= static_cast < sal_Int32 > (m_aChucker.GetPosition()); for (ZipEntry* p : m_aZipList) { diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 43a9b8567aa0..5efb145fd9f7 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -486,6 +486,17 @@ private: catch (const uno::Exception&) { mpEntry->setParallelDeflateException(::cppu::getCaughtException()); + try + { + if (mpEntry->m_xOutStream.is()) + mpEntry->closeBufferFile(); + if (!mpEntry->m_aTempURL.isEmpty()) + mpEntry->deleteBufferFile(); + } + catch (uno::Exception const&) + { + } + mpEntry->setFinished(); } } }; |