sw/source/uibase/wrtsh/wrtsh1.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit dd72fd35bbe35798026f2f22189e34e57cf6d65c
Author:     Jim Raykowski <[email protected]>
AuthorDate: Sat Sep 27 22:45:23 2025 -0800
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Oct 1 10:24:37 2025 +0200

    tdf#167405 Fix outline folding crash
    
    In this case one that happens on folding outline content when the
    document view is set to 'Web' and the Navigator is open.
    
    SwDocShell::Broadcast(SfxHint(SfxHintId::DocChanged)) in
    SwRootFrame::CheckViewLayout causes an update of the Navigator content
    tracking which when SwWrtShell::GetContentAtPos is called in
    SwContentTree::Update eventually fails an assert in
    
objectpositioning::SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrame
    with the assert message:
    
    "SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrame(..) -
    found frame isn't a layout frame"
    
    stack at crash:
    
    
objectpositioning::SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrame
      environmentofanchoredobject.cxx 91
    objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition
      tocntntanchoredobjectposition.cxx 287
    SwFlyAtContentFrame::MakeObjPosfly cnt.cxx 1522
    SwFlyFreeFrame::MakeAll flylay.cxx 222
    SwFlyAtContentFrame::MakeAll flycnt.cxx 413
    SwFrame::PrepareMake calcmove.cxx 396
    SwFrame::Calc trvlfrm.cxx 1858
    SwFlyFrame::Calc fly.cxx 3438
    SwFlyFrame::GetModelPositionForViewPoint trvlfrm.cxx 567
    (anonymous namespace)::lcl_GetModelPositionForViewPoint_Objects
      trvlfrm.cxx 87
    SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx 208
    SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx 477
    SwCursorShell::GetContentAtPos crstrvl.cxx 1519
    SwContentTree::UpdateTracking content.cxx 4779
    SwContentTree::TimerUpdate content.cxx 4668
    SwContentTree::Notify content.cxx 4046
    SfxBroadcaster::Broadcast SfxBroadcaster.cxx 43
    SwRootFrame::CheckViewLayout pagechg.cxx 2515
    SwFrame::AdjustNeighbourhood wsfrm.cxx 1816
    SwLayoutFrame::ShrinkFrame wsfrm.cxx 3020
    SwFrame::Shrink wsfrm.cxx 1635
    SwContentFrame::Cut wsfrm.cxx 1390
    SwContentNode::DelFrames node.cxx 1552
    SwWrtShell::MakeOutlineContentVisible wrtsh1.cxx 2649
    SwWrtShell::InvalidateOutlineContentVisibility wrtsh1.cxx 2703
    SwEditWin::ToggleOutlineContentVisibility edtwin.cxx 7135
    
    Fixed by waiting to paint until after removal of content frames during
    InvalidateOutlineContentVisibility.
    
    Change-Id: I69fdf173763211f42c5079069e79253ccdc19d79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191576
    Reviewed-by: Jim Raykowski <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit c2ad58945c22bf7c8e77c70fc66af1faf998ac54)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191705
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 0b2044c90def..7d739ad2d846 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2683,6 +2683,8 @@ void SwWrtShell::MakeOutlineContentVisible(const size_t 
nPos, bool bMakeVisible,
 // make content visible or not visible only if needed
 void SwWrtShell::InvalidateOutlineContentVisibility()
 {
+    StartAction();
+
     
GetView().GetEditWin().GetFrameControlsManager().HideControls(FrameControlType::Outline);
 
     const SwOutlineNodes& rOutlineNds = GetNodes().GetOutLineNds();
@@ -2695,6 +2697,8 @@ void SwWrtShell::InvalidateOutlineContentVisibility()
         else if (bIsOutlineContentVisible && !bOutlineContentVisibleAttr)
             MakeOutlineContentVisible(nPos, false);
     }
+
+    EndAction();
 }
 
 void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible)
@@ -2720,9 +2724,7 @@ void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool 
bMakeVisible)
             }
         }
 
-        StartAction();
         InvalidateOutlineContentVisibility();
-        EndAction();
 
         // restore outline content visible attribute for folded outline nodes
         for (SwNode* pNd: aFoldedOutlineNodeArray)
@@ -2736,9 +2738,7 @@ void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool 
bMakeVisible)
         // node if it is not visible after InvalidateOutlineContentVisiblity 
below.
         SwOutlineNodes::size_type nPos = GetOutlinePos();
 
-        StartAction();
         InvalidateOutlineContentVisibility();
-        EndAction();
 
         // If needed, find a visible outline node to place the cursor.
         if (nPos != SwOutlineNodes::npos && !IsOutlineContentVisible(nPos))

Reply via email to