diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-04-07 09:05:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-05-06 22:25:33 +0200 |
commit | 57f8e4fd10bc3293122371518397a0770ad081ac (patch) | |
tree | bef640909b34549e826f158be7f3790ab8c7d9ae /dbaccess | |
parent | ad7b87a03ef175330582fd14a687df507596c3b1 (diff) |
Related tdf#97694 Fix macro preservation on Windows
Change-Id: Ief183c75e0c3ce6c42868b7c60c5f66f9684d743
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91795
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 792c730f3cda4f5c312921a62ecae3d322ad9b72)
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 0d9e842d8283..1888634776af 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1098,17 +1098,20 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph // store to current storage Reference< XStorage > xCurrentStorage( m_pImpl->getOrCreateRootStorage(), UNO_SET_THROW ); + OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(xCurrentStorage)); Sequence< PropertyValue > aMediaDescriptor( lcl_appendFileNameToDescriptor( _rArguments, _rURL ) ); impl_storeToStorage_throw( xCurrentStorage, aMediaDescriptor, _rGuard ); // Preserve script signature if the script has not changed if (bTryToPreserveScriptSignature) { + // Need to close this storage, otherwise we can't open it for signing below + // (Windows needs exclusive file access) + uno::Reference < lang::XComponent > xComp = xCurrentStorage; + xComp->dispose(); uno::Reference<security::XDocumentDigitalSignatures> xDDSigns; try { - OUString aODFVersion( - comphelper::OStorageHelper::GetODFVersionFromStorage(xCurrentStorage)); xDDSigns = security::DocumentDigitalSignatures::createWithVersion( comphelper::getProcessComponentContext(), aODFVersion); @@ -1166,7 +1169,7 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph } catch (uno::Exception&) { - SAL_WARN("dbaccess", "Preserving macro signature failed!"); + TOOLS_WARN_EXCEPTION("dbaccess", ""); } } |