[Libreoffice-commits] core.git: sw/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Feb 19 10:50:50 UTC 2018


 sw/source/core/edit/edfcol.cxx |   29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 48fd0d45288bd8501f14c993cf613fe7743fabcd
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Feb 14 07:35:44 2018 -0500

    tdf#115569 don't sign or validate text in tables
    
    Both undoing signatures and updating the metafield
    are causing seg-faults. Clearly more work is needed
    to support paragraph signing within tables, so
    disabled for now.
    
    Change-Id: Ia20c8b07069689b0e8b7d11a634a2a48ef1f0fa3
    Reviewed-on: https://gerrit.libreoffice.org/49722
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index f4e4736b02e0..8ace8092a783 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -480,12 +480,20 @@ bool lcl_DoUpdateParagraphSignatureField(SwDoc* pDoc,
         pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
     });
 
-    uno::Reference<css::text::XTextRange> xText(xField, uno::UNO_QUERY);
-    const OUString curText = xText->getString();
-    if (curText != sDisplayText)
+    try
+    {
+        uno::Reference<css::text::XTextRange> xText(xField, uno::UNO_QUERY);
+        const OUString curText = xText->getString();
+        if (curText != sDisplayText)
+        {
+            xText->setString(sDisplayText);
+            return true;
+        }
+    }
+    catch (const uno::Exception& ex)
     {
-        xText->setString(sDisplayText);
-        return true;
+        // We failed; avoid crashing.
+        SAL_WARN("sw.uno", "Failed to update paragraph signature: " << ex);
     }
 
     return false;
@@ -1734,6 +1742,10 @@ void SwEditShell::SignParagraph()
     if (!pNode)
         return;
 
+    // Table text signing is not supported.
+    if (pNode->FindTableNode() != nullptr)
+        return;
+
     // 1. Get the text (without fields).
     const uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
     const OString utf8Text = lcl_getParagraphBodyText(xParagraph);
@@ -1808,7 +1820,12 @@ void SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
             SetParagraphSignatureValidation(bOldValidationFlag);
         });
 
-    lcl_ValidateParagraphSignatures(GetDoc(), SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode), updateDontRemove);
+    // Table text signing is not supported.
+    if (pNode->FindTableNode() != nullptr)
+        return;
+
+    uno::Reference<text::XTextContent> xParentText = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
+    lcl_ValidateParagraphSignatures(GetDoc(), xParentText, updateDontRemove);
 }
 
 void SwEditShell::ValidateAllParagraphSignatures(bool updateDontRemove)


More information about the Libreoffice-commits mailing list