[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - embeddedobj/source

Armin Le Grand (Allotropia) (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 8 17:50:55 UTC 2021


 embeddedobj/source/commonembedding/persistence.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit b6928c98870ad9dfe261d870fc3411c4eda7902b
Author:     Armin Le Grand (Allotropia) <armin.le.grand at me.com>
AuthorDate: Wed Apr 7 11:15:04 2021 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Apr 8 19:50:23 2021 +0200

    tdf#141528 ensure that reset of linked state is executed
    
    Take m_xDocHolder->GetComponent() and xModif->setModified
    inside the local try..catch expression to ensure that the
    reset of the linked state below (m_bIsLink and .clear())
    is executed
    
    Change-Id: I52d49569a43fd2c23dd997c7217f7552cbdcfb82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113722
    Tested-by: Armin Le Grand <Armin.Le.Grand at me.com>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
    (cherry picked from commit 2f665daa29dd5509b4ceb0461e76292e2262fa56)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113761
    Tested-by: Jenkins

diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 3e4ab0dd989f..bf0bcdf2bbf2 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1789,10 +1789,21 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
     // TODO/LATER: handle the case when temp doc can not be created
     // the document is a new embedded object so it must be marked as modified
     uno::Reference< util::XCloseable > xDocument = CreateTempDocFromLink_Impl();
-    uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
     try
     {
-        xModif->setModified( true );
+        if(m_xDocHolder.is() && m_xDocHolder->GetComponent().is())
+        {
+            // tdf#141528 m_xDocHolder->GetComponent() may be not set, so add it
+            // to the try path to not get thrown out of the local context to the next
+            // highter try...catch on the stack. To make breakLink work it is
+            // *necessary* to execute the code below that resets the linked state,
+            // esp. the *.clear stuff and resetting m_bIsLink.
+            uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
+
+            // all other locations in this file check for xModif.is(), so do it here, too
+            if ( xModif.is() )
+                xModif->setModified( true );
+        }
     }
     catch( const uno::Exception& )
     {}


More information about the Libreoffice-commits mailing list