sw/source/core/doc/docbm.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 2f726fa41cbd249f2fb30222b29d5f30bce52e6e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Apr 20 15:04:47 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Apr 20 16:55:44 2022 +0200

    tdf#147723 sw_fieldmarkhide: fix crash when copying multiple fieldmarks
    
    The problem is the UpdateFramesForAddDeleteRedline() call in makeMark(),
    this is called in a loop for multiple fieldmarks and when it's called
    for the first one, of course the other ones aren't in the document yet,
    so HideIterator::Next() can't find them.
    
    But this is only needed when inserting a new fieldmark anyway, so just
    disable for copying.
    
    (regression from commit 92384a813176b964a67bcbeb2fa617c554dbc4a2)
    
    Change-Id: Ic1b34d469a553cf7bbf2d1a99edaea900bdd7417
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133215
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 46bf4d4cdd07..6bc74340689f 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -683,8 +683,9 @@ namespace sw::mark
                 // no special array for these
                 break;
         }
-        if (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK
-            || eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK)
+        if (eMode == InsertMode::New
+            && (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK
+                || eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK))
         {
             // due to SwInsText notifications everything is visible now - tell
             // layout to hide as appropriate

Reply via email to