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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 5 19:26:27 UTC 2020


 sw/source/core/edit/edfcol.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit be44b86998b2681d0de231bd9f5364a968e7c6b8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Oct 5 12:18:59 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Oct 5 21:25:40 2020 +0200

    SwEditShell::SignParagraph always dereferences GetDoc()
    
    Change-Id: I4f45db8fdab7679de0f7eacf8f14a24539ae0d5f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103963
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 4323022526de..6fd50e7536d8 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1743,7 +1743,8 @@ void SwUndoParagraphSigning::Remove()
 
 void SwEditShell::SignParagraph()
 {
-    SwDocShell* pDocShell = GetDoc()->GetDocShell();
+    SwDoc& rDoc = *GetDoc();
+    SwDocShell* pDocShell = rDoc.GetDocShell();
     if (!pDocShell || !GetCursor() || !GetCursor()->Start())
         return;
     const SwPosition* pPosStart = GetCursor()->Start();
@@ -1801,17 +1802,17 @@ void SwEditShell::SignParagraph()
             SetParagraphSignatureValidation(bOldValidationFlag);
         });
 
-    GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
+    rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
 
     const uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
     uno::Reference<css::text::XTextField> xField = lcl_InsertParagraphSignature(xModel, xParagraph, signature, aUsage);
 
     lcl_UpdateParagraphSignatureField(*GetDoc(), xModel, xParagraph, xField, utf8Text);
 
-    GetDoc()->GetIDocumentUndoRedo().AppendUndo(
+    rDoc.GetIDocumentUndoRedo().AppendUndo(
         std::make_unique<SwUndoParagraphSigning>(GetDoc(), xField, xParagraph, true));
 
-    GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
+    rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
 }
 
 void SwEditShell::ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove)


More information about the Libreoffice-commits mailing list