sw/source/core/layout/sortedobjs.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 31f3e6f15b40514da1567859286d1f567fed0c8c
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Nov 22 09:59:44 2024 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Nov 25 11:13:00 2024 +0100

    crashtesting: invalid iterator on load of forum-de-1233.odt docx export
    
    although the actual order doesn't change there is a Delete/Insert of
    the object in case the order should change.
    
    ::Insert will check if sorted and resort if not anyway, so presumably
    if we just skip the middle-men and resort here if we need to then that
    is equivalent, but without the invalidation for the already sorted case.
    
     #0  SwSortedObjs::Remove (this=0x510ed40, _rAnchoredObj=...) at 
core/sw/source/core/layout/sortedobjs.cxx:243
     #1  0x00007fffce0af130 in SwSortedObjs::Update (this=0x510ed40, 
_rAnchoredObj=...) at core/sw/source/core/layout/sortedobjs.cxx:282
     #2  0x00007fffcdf32c40 in SwAnchoredObject::UpdateObjInSortedList 
(this=0x51123c0) at core/sw/source/core/layout/anchoredobject.cxx:661
     #3  0x00007fffcdf8fc38 in SwFlyFrame::SwClientNotify (this=0x5112260, 
rMod=..., rHint=...) at core/sw/source/core/layout/fly.cxx:859
     #4  0x00007fffcdf9d1bf in SwFlyAtContentFrame::SwClientNotify 
(this=0x5112260, rMod=..., rHint=...) at 
core/sw/source/core/layout/flycnt.cxx:112
     #5  0x00007fffcd65bca8 in SwModify::CallSwClientNotify (this=0x4e68da0, 
rHint=...) at core/sw/source/core/attr/calbck.cxx:311
     #6  0x00007fffcd65bd71 in sw::BroadcastingModify::CallSwClientNotify 
(this=0x4e68da0, rHint=...) at core/sw/source/core/attr/calbck.cxx:316
     #7  0x00007fffcd65b42f in SwModify::SwClientNotify (this=0x4e68da0, 
rHint=...) at core/sw/source/core/attr/calbck.cxx:302
     #8  0x00007fffcd66771b in SwFormat::SwClientNotify (this=0x4e68da0, 
rHint=...) at core/sw/source/core/attr/format.cxx:300
     #9  0x00007fffcdf4448a in SwFrameFormat::SwClientNotify (this=0x4e68da0, 
rMod=..., rHint=...) at core/sw/source/core/layout/atrfrm.cxx:2843
     #10 0x00007fffcd65be1e in sw::ClientNotifyAttrChg (rModify=..., aSet=..., 
aOld=..., aNew=...) at core/sw/source/core/attr/calbck.cxx:325
     #11 0x00007fffcd66948e in SwFormat::SetFormatAttr (this=0x4e68da0, 
rSet=SfxItemSet of pool 0x1bcebe0 with parent 0x4e68e68 and Which ranges: [(88, 
141), (159, 159), (1014, 1034)] = {...})
         at core/sw/source/core/attr/format.cxx:597
     #12 0x00007fffce649a2c in SwXFrame::setPropertyValue (this=0x5e47b90, 
rPropertyName="Size", _rValue=uno::Any("com.sun.star.awt.Size": ...))
         at core/sw/source/core/unocore/unoframe.cxx:1867
     #13 0x00007fffcdc4d7ea in SwTextBoxHelper::syncProperty (pShape=0x4dce770, 
nWID=89, nMemberID=0 '
         at core/sw/source/core/doc/textboxhelper.cxx:995
     #14 0x00007fffcdf2e2d7 in SwAnchoredDrawObject::GetObjBoundRect 
(this=0x4e69dd0) at core/sw/source/core/layout/anchoreddrawobject.cxx:757
     #15 0x00007fffcdf320ca in SwAnchoredObject::GetObjRectWithSpaces 
(this=0x4e69dd0) at core/sw/source/core/layout/anchoredobject.cxx:575
     #16 0x00007fffcdf31eaa in 
SwAnchoredObject::InvalidateObjPosForConsiderWrapInfluence (this=0x4e69dd0) at 
core/sw/source/core/layout/anchoredobject.cxx:400
     #17 0x00007fffcdf32be5 in SwAnchoredObject::UpdateObjInSortedList 
(this=0x510e530) at core/sw/source/core/layout/anchoredobject.cxx:654
     #18 0x00007fffcdf8fc38 in SwFlyFrame::SwClientNotify (this=0x510e3d0, 
rMod=..., rHint=...) at core/sw/source/core/layout/fly.cxx:859
     #19 0x00007fffcdf9d1bf in SwFlyAtContentFrame::SwClientNotify 
(this=0x510e3d0, rMod=..., rHint=...) at 
core/sw/source/core/layout/flycnt.cxx:112
     #20 0x00007fffcd65bca8 in SwModify::CallSwClientNotify (this=0x4e364a0, 
rHint=...) at core/sw/source/core/attr/calbck.cxx:311
     #21 0x00007fffcd65bd71 in sw::BroadcastingModify::CallSwClientNotify 
(this=0x4e364a0, rHint=...) at core/sw/source/core/attr/calbck.cxx:316
     #22 0x00007fffcd65b42f in SwModify::SwClientNotify (this=0x4e364a0, 
rHint=...) at core/sw/source/core/attr/calbck.cxx:302
     #23 0x00007fffcd66771b in SwFormat::SwClientNotify (this=0x4e364a0, 
rHint=...) at core/sw/source/core/attr/format.cxx:300
     #24 0x00007fffcdf4448a in SwFrameFormat::SwClientNotify (this=0x4e364a0, 
rMod=..., rHint=...) at core/sw/source/core/layout/atrfrm.cxx:2843
     #25 0x00007fffcd65be1e in sw::ClientNotifyAttrChg (rModify=..., aSet=..., 
aOld=..., aNew=...) at core/sw/source/core/attr/calbck.cxx:325
     #26 0x00007fffcd66948e in SwFormat::SetFormatAttr (this=0x4e364a0, 
rSet=SfxItemSet of pool 0x1bcebe0 with parent 0x4e36568 and Which ranges: [(88, 
141), (159, 159), (1014, 1034)] = {...})
         at core/sw/source/core/attr/format.cxx:597
     #27 0x00007fffce649a2c in SwXFrame::setPropertyValue (this=0x4a86e10, 
rPropertyName="Size", _rValue=uno::Any("com.sun.star.awt.Size": ...))
         at core/sw/source/core/unocore/unoframe.cxx:1867
     #28 0x00007fffcdc4d7ea in SwTextBoxHelper::syncProperty (pShape=0x4dc65f0, 
nWID=89, nMemberID=0 '
         at core/sw/source/core/doc/textboxhelper.cxx:995
     #29 0x00007fffcdf2e2d7 in SwAnchoredDrawObject::GetObjBoundRect 
(this=0x4e3a0d0) at core/sw/source/core/layout/anchoreddrawobject.cxx:757
     #30 0x00007fffcdf320ca in SwAnchoredObject::GetObjRectWithSpaces 
(this=0x4e3a0d0) at core/sw/source/core/layout/anchoredobject.cxx:575
     #31 0x00007fffcdf815b3 in (anonymous namespace)::IsNextContentFullPage 
(rThis=...) at core/sw/source/core/layout/flowfrm.cxx:217
     #32 0x00007fffcdf81002 in SwFlowFrame::IsKeep (this=0x4e5a630, rKeep=..., 
rBreak=..., bCheckIfLastRowShouldKeep=false) at 
core/sw/source/core/layout/flowfrm.cxx:259
    
    Change-Id: If2191e8b99d1b0347bab54a704013ce0a9a19410
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176992
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit f2cf4d91687fcebcad90a839dd5232a28b47e6e1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177030
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/sortedobjs.cxx 
b/sw/source/core/layout/sortedobjs.cxx
index e0c29d51801c..da3fba27598a 100644
--- a/sw/source/core/layout/sortedobjs.cxx
+++ b/sw/source/core/layout/sortedobjs.cxx
@@ -275,8 +275,10 @@ void SwSortedObjs::Update( SwAnchoredObject& _rAnchoredObj 
)
         return;
     }
 
-    Remove( _rAnchoredObj );
-    Insert( _rAnchoredObj );
+    if (is_sorted())
+        return;
+
+    UpdateAll();
 }
 
 void SwSortedObjs::UpdateAll()

Reply via email to