sw/source/uibase/shells/textfld.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit bcf4b998741da342d8612dfa2ac8b9d5d95269d4
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Aug 5 13:00:59 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Aug 7 13:29:41 2024 +0200

    no need to do lookup here
    
    when we have just created the object, we already know what it is
    
    Change-Id: I79ccc178219ff32a1c88ce7a0b2f4948a6bd4dbb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171567
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 4af3042acfe3..88ad90347ceb 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -1372,7 +1372,7 @@ FIELD_INSERT:
                 aNewBookmarkPaM.SetMark();
                 assert(aNewBookmarkPaM.GetPointContentNode() && "only 
SetContent on content node");
                 aNewBookmarkPaM.Start()->SetContent(nStartContentIndex);
-                rIDMA.makeMark(aNewBookmarkPaM,
+                sw::mark::MarkBase* pNewMark = rIDMA.makeMark(aNewBookmarkPaM,
                                sBookmarkName,
                                IDocumentMarkAccess::MarkType::BOOKMARK,
                                sw::mark::InsertMode::New);
@@ -1382,10 +1382,9 @@ FIELD_INSERT:
                     && rSh.SetCursorInHdFt(nPageDescIndex, bHeader, 
/*Even=*/true))
                 {
                     assert(nEvenPage && "what? no even page and yet we got 
here?");
-                    ppMark = rIDMA.findMark(sBookmarkName);
-                    if (ppMark != rIDMA.getAllMarksEnd() && *ppMark)
+                    if (pNewMark)
                     {
-                        SwPaM aDeleteOldPageNum((*ppMark)->GetMarkStart(), 
(*ppMark)->GetMarkEnd());
+                        SwPaM aDeleteOldPageNum(pNewMark->GetMarkStart(), 
pNewMark->GetMarkEnd());
                         
rDoc.getIDocumentContentOperations().DeleteAndJoin(aDeleteOldPageNum);
                     }
 

Reply via email to