sfx2/source/doc/objstor.cxx |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit fdab153636ad7e3ce4b09836a63d2fa11b42e728
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Sun Apr 28 15:21:39 2019 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sun Apr 28 20:42:08 2019 +0200

    WebDav: Don't unlock the file during saving of a document
    
    Otherwise it can happen that the file is locked by someone
    else during the saving method is running.
    I just extended the scope of the existing DisableUnlockWebDAV()
    calls a bit. In case of webdav it does not cause an issue to
    avoid unlocking the file before locking it again with an other
    SfxMedium.
    
    Change-Id: I6ac4e3326c63c9e184a7710ce8994cac1ed79449
    Reviewed-on: https://gerrit.libreoffice.org/71484
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 4d3f2cc64925..6ef63cdfbdac 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1183,6 +1183,10 @@ bool SfxObjectShell::SaveTo_Impl
       && !rMedium.GetName().equalsIgnoreAsciiCase("private:stream")
       && ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), 
rMedium.GetName() ) )
     {
+        // Do not unlock the file during saving.
+        // need to modify this for WebDAV if this method is called outside of
+        // the process of saving a file
+        pMedium->DisableUnlockWebDAV();
         bStoreToSameLocation = true;
 
         if ( pMedium->DocNeedsFileDateCheck() )
@@ -1275,6 +1279,7 @@ bool SfxObjectShell::SaveTo_Impl
                 rMedium.GetOutStream();
             }
         }
+        pMedium->DisableUnlockWebDAV(false);
     }
     else
     {
@@ -1703,10 +1708,6 @@ bool SfxObjectShell::SaveTo_Impl
     return bOk;
 }
 
-
-// This method contains a call to disable the UNLOCK of a WebDAV resource, 
that work while saving a file.
-// If the method is called from another process (e.g. not when saving a file),
-// that disabling needs tweaking
 bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& 
rTargetMedium )
 {
     // this method disconnects the storage from source medium, and attaches it 
to the backup created by the target medium
@@ -1727,12 +1728,7 @@ bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& 
rSrcMedium, SfxMedium& r
                 rTargetMedium.ResetError();
                 xOptStorage->writeAndAttachToStream( uno::Reference< 
io::XStream >() );
                 rSrcMedium.CanDisposeStorage_Impl( false );
-                // need to modify this for WebDAV if this method is called 
outside
-                // the process of saving a file
-                rSrcMedium.DisableUnlockWebDAV();
                 rSrcMedium.Close();
-                // see comment on the previous third row
-                rSrcMedium.DisableUnlockWebDAV( false );
 
                 // now try to create the backup
                 rTargetMedium.GetBackup_Impl();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to