dbaccess/source/core/dataaccess/ModelImpl.cxx |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

New commits:
commit 3a68efa1812fe11c52aeb06a8d8e9e191d2c47aa
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Tue Apr 21 07:43:26 2020 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri May 1 17:55:35 2020 +0200

    Fix storage access after saving
    
    Change-Id: I2cd664ac2ca5e80c566efee35bd34e7223501d75
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92605
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    (cherry picked from commit 7dbff6fa55829e53be042e213b454d2466ff80fa)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93190
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx 
b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index b88e3b06b761..d5c3b9b3e086 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -881,10 +881,6 @@ bool 
ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
     // 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();
         OUString 
aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(_rxStorage));
         uno::Reference<security::XDocumentDigitalSignatures> xDDSigns;
         try
@@ -905,15 +901,8 @@ bool 
ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
                 uno::Reference<embed::XStorage> xMetaInf
                     = xReadOrig->openStorageElement("META-INF", 
embed::ElementModes::READ);
 
-                OUString aURL = getDocFileLocation();
-                Reference<XStorage> xTarget
-                    = comphelper::OStorageHelper::GetStorageOfFormatFromURL(
-                        ZIP_STORAGE_FORMAT_STRING, aURL, 
ElementModes::READWRITE);
-                if (!xTarget.is())
-                    throw uno::RuntimeException("Could not read " + aURL);
                 uno::Reference<embed::XStorage> xTargetMetaInf
-                    = xTarget->openStorageElement("META-INF", 
embed::ElementModes::READWRITE);
-
+                    = _rxStorage->openStorageElement("META-INF", 
embed::ElementModes::READWRITE);
                 if (xMetaInf.is() && xTargetMetaInf.is())
                 {
                     xMetaInf->copyElementTo(aScriptSignName, xTargetMetaInf, 
aScriptSignName);
@@ -928,13 +917,13 @@ bool 
ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
                     // now check the copied signature
                     uno::Sequence<security::DocumentSignatureInformation> 
aInfos
                         = xDDSigns->verifyScriptingContentSignatures(
-                            xTarget, uno::Reference<io::XInputStream>());
+                            _rxStorage, uno::Reference<io::XInputStream>());
                     SignatureState nState = 
DocumentSignatures::getSignatureState(aInfos);
                     if (nState == SignatureState::OK || nState == 
SignatureState::NOTVALIDATED
                         || nState == SignatureState::PARTIAL_OK)
                     {
                         // commit the ZipStorage from target medium
-                        xTransact.set(xTarget, uno::UNO_QUERY);
+                        xTransact.set(_rxStorage, uno::UNO_QUERY);
                         if (xTransact.is())
                             xTransact->commit();
                     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to