summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-06-23 22:02:04 +0200
committerMichael Stahl <mstahl@redhat.com>2016-06-23 22:39:51 +0200
commit9084c11fb472f2024e609770ce922c911227e7a8 (patch)
treee45a09ec09a76f77e174095dcfc9440ba9869971
parent716f4ef1625cece6fe8326213df24c52d56c9432 (diff)
sfx2: exception on storage commit is an error (related: tdf#91807)
For no good or obvious reason, SfxMedium::StorageCommit_Impl() swallows embed::UseBackupException if there is a pTempFile, which (as the comment claims) is "always now". This results in the temp file actually being copied to the user-visible file and the SaveAs "succeeding", when it clearly did not. Also move the exception throwing to the end of ZipOutputStream::finish() to avoid more memory leaks. Change-Id: I448cc43291754ef20adfa6b65916282fcc365a11
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx10
-rw-r--r--sfx2/source/doc/docfile.cxx6
2 files changed, 8 insertions, 8 deletions
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 2daff01fc1c2..41f78b414879 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -183,11 +183,6 @@ 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)
{
@@ -197,6 +192,11 @@ void ZipOutputStream::finish()
writeEND( nOffset, static_cast < sal_Int32 > (m_aChucker.GetPosition()) - nOffset);
m_xStream->flush();
m_aZipList.clear();
+
+ if (m_aDeflateException.hasValue())
+ { // throw once all threads are finished and m_aEntries can be released
+ ::cppu::throwException(m_aDeflateException);
+ }
}
const css::uno::Reference< css::io::XOutputStream >& ZipOutputStream::getStream()
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b64e8d317386..c4ce8719238c 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1625,10 +1625,10 @@ bool SfxMedium::StorageCommit_Impl()
OSL_ENSURE( !pImpl->m_aName.isEmpty(), "The exception _must_ contain the temporary URL!\n" );
}
}
-
- if ( !GetError() )
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
}
+
+ if (!GetError())
+ SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
}
catch ( const uno::Exception& )
{