[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - sfx2/source

Jan-Marek Glogowski glogow at fbihome.de
Fri Apr 20 11:42:50 UTC 2018


 sfx2/source/doc/docfile.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5d53afc54e0b94f95176b1be7044f556927c1b13
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Sep 19 17:29:07 2017 +0200

    Don't crash when opening templates via WebDAV
    
    When loading a ODT template via HTTP, it crashes LO with an
    lang::IllegalArgumentException in LockFileCommon::ResolveLinks.
    This happens when closing the loaded template, as LO tries to
    remove a not-existing lock. aDocURL at this point is empty, so
    HasError() is true.
    
    As stated in the comment, we don't need a lock for documents
    created from templates, as this opens an internal copy of the
    document, so don't mark the teplate document as locked.
    
    Change-Id: Ide60020b6287aa67861dbcc8ec1b94f37896b7ef
    Reviewed-on: https://gerrit.libreoffice.org/42485
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit f95e7ef38e0bf79fa9662bfd50de612d50ef71de)
    Reviewed-on: https://gerrit.libreoffice.org/53195
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index bf637cbb1bfe..0ce5ef0ec930 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1055,15 +1055,16 @@ SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand( bool bLoading, bool b
         try
         {
             bool bResult = pImpl->m_bLocked;
+            bool bIsTemplate = false;
             // so, this is webdav stuff...
             if ( !bResult )
             {
                 // no read-write access is necessary on loading if the document is explicitly opened as copy
                 const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_TEMPLATE, false);
-                bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() );
+                bIsTemplate = ( bLoading && pTemplateItem && pTemplateItem->GetValue() );
             }
 
-            if ( !bResult && !IsReadOnly() )
+            if ( !bIsTemplate && !bResult && !IsReadOnly() )
             {
                 ShowLockResult bUIStatus = ShowLockResult::NoLock;
                 do


More information about the Libreoffice-commits mailing list