Kaydet (Commit) 4eaff124 authored tarafından Tamás Zolnai's avatar Tamás Zolnai Kaydeden (comit) Andras Timar

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: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit fdab1536)
Reviewed-on: https://gerrit.libreoffice.org/71512Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 0033e485
...@@ -1200,6 +1200,10 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1200,6 +1200,10 @@ bool SfxObjectShell::SaveTo_Impl
&& !rMedium.GetName().equalsIgnoreAsciiCase("private:stream") && !rMedium.GetName().equalsIgnoreAsciiCase("private:stream")
&& ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) ) && ::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; bStoreToSameLocation = true;
if ( pMedium->DocNeedsFileDateCheck() ) if ( pMedium->DocNeedsFileDateCheck() )
...@@ -1298,6 +1302,7 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1298,6 +1302,7 @@ bool SfxObjectShell::SaveTo_Impl
} }
} }
} }
pMedium->DisableUnlockWebDAV(false);
} }
else else
{ {
...@@ -1718,10 +1723,6 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1718,10 +1723,6 @@ bool SfxObjectShell::SaveTo_Impl
return bOk; 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 ) 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 // this method disconnects the storage from source medium, and attaches it to the backup created by the target medium
...@@ -1742,12 +1743,7 @@ bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& r ...@@ -1742,12 +1743,7 @@ bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& r
rTargetMedium.ResetError(); rTargetMedium.ResetError();
xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() ); xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() );
rSrcMedium.CanDisposeStorage_Impl( false ); 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(); rSrcMedium.Close();
// see comment on the previous third row
rSrcMedium.DisableUnlockWebDAV( false );
// now try to create the backup // now try to create the backup
rTargetMedium.GetBackup_Impl(); rTargetMedium.GetBackup_Impl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment