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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 20 16:25:29 UTC 2021


 sw/source/core/doc/DocumentRedlineManager.cxx |   15 +++++++++++----
 sw/source/core/text/txtfrm.cxx                |    2 ++
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 2ec6b5055dc09ab3884dc2542dd93e75fe2c50d4
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Thu Jan 14 20:10:24 2021 +0100
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Wed Jan 20 17:25:06 2021 +0100

    tdf#135014 sw_redlinehide: fix missing frames when removing fieldmark
    
    A fieldmark was deleted. UpdateFramesForRemoveDeleteRedline() deleted
    the MergedPara but its start node was before the start node of the
    fieldmark, and then MakeFrames() didn't find a frame on the preceding
    node and did nothing.
    
    Similar problem likely possible with redline.
    
    Change-Id: I532f9a67c0268f3287736a61da4cc9fefec7b8e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109307
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    (cherry picked from commit 32e104c1d6be0ffe6ed6c4e08af868c87b3c258c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109346
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 337c0429107d..25d26f6a7743 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -316,6 +316,8 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
                     pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
                         *pFrame, rFirstNode, eMode));
                     eMode = sw::FrameMode::New; // Existing is not idempotent!
+                    // update pNode so MakeFrames starts on 2nd node
+                    pNode = &rFirstNode;
                 }
             }
             if (pLast != pNode)
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 4e2d8af0bcb9..13f48b3ba321 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1278,6 +1278,8 @@ void SwTextFrame::SetMergedPara(std::unique_ptr<sw::MergedPara> p)
             pFirst->Add(this); // must register at node again
         }
     }
+    // postcondition: frame must be listening somewhere
+    assert(m_pMergedPara || GetDep());
 }
 
 const OUString& SwTextFrame::GetText() const
commit 60eb993b5558c7999a23b4e3c241b2a60419a3d4
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Thu Jan 14 19:33:34 2021 +0100
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Wed Jan 20 17:24:49 2021 +0100

    tdf#135014 sw_fieldmarkhide: fix crash deleting field in fly
    
    SwUndoDelete calls DelContentIndex(), which calls
    SwUndoFlyBase::DelFly().
    
    This calls DelFrames() first and then SwUndoSaveSection::SaveSection(),
    so by the time UpdateFramesForRemoveDeleteRedline() runs for the
    fieldmark in fly it's expected that there are no more frames.
    
    Also, don't try to recreate fly frames in this situation; it will crash
    when resetting the RES_ANCHOR.
    
    Change-Id: I11f6fb011d84e96f77b93ffbd1b5904594cbc591
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109306
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    (cherry picked from commit eef10be20a4c5108c68b19ccdda263c5ca852386)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109345
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 4a63d5e443ac..337c0429107d 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -286,10 +286,15 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
             }
             if (frames.empty())
             {
-                auto const& layouts(rDoc.GetAllLayouts());
-                assert(std::none_of(layouts.begin(), layouts.end(),
-                    [](SwRootFrame const*const pLayout) { return pLayout->IsHideRedlines(); }));
-                (void) layouts;
+                // in SwUndoSaveSection::SaveSection(), DelFrames() preceded this call
+                if (!pNode->FindTableBoxStartNode() && !pNode->FindFlyStartNode())
+                {
+                    auto const& layouts(rDoc.GetAllLayouts());
+                    assert(std::none_of(layouts.begin(), layouts.end(),
+                        [](SwRootFrame const*const pLayout) { return pLayout->IsHideRedlines(); }));
+                    (void) layouts;
+                }
+                isAppendObjsCalled = true; // skip that!
                 break;
             }
 


More information about the Libreoffice-commits mailing list