[Libreoffice-commits] core.git: sw/source

Michael Stahl mstahl at redhat.com
Fri Feb 12 22:42:48 UTC 2016


 sw/source/core/layout/pagechg.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit cf91483690291272f48ff95c1aebd165da8ae4f0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Feb 12 23:33:36 2016 +0100

    sw: fix a STL assertion in lcl_MoveAllLowerObjs()
    
    For OLE objects MoveObjectIfActive() ends up calling
    SwSortedObjs::Update() which removes and re-inserts objects,
    thus invalidating the pSortedObj iterator.
    
    (regression from 04783fd91832fa01a5b096f395edd7ad4f9c0f6b)
    
    Change-Id: I2628f1b4ecd1c20ebbc4e9dda4e4befc9fad4644

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 42ae8ac..1c9e803 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1761,8 +1761,11 @@ static void lcl_MoveAllLowerObjs( SwFrame* pFrame, const Point& rOffset )
     if (pSortedObj == nullptr)
         return;
 
-    for (SwAnchoredObject* pAnchoredObj : *pSortedObj)
+    // note: pSortedObj elements may be removed and inserted from
+    // MoveObjectIfActive(), invalidating iterators
+    for (size_t i = 0; i < pSortedObj->size(); ++i)
     {
+        SwAnchoredObject *const pAnchoredObj = (*pSortedObj)[i];
         const SwFrameFormat& rObjFormat = pAnchoredObj->GetFrameFormat();
         const SwFormatAnchor& rAnchor = rObjFormat.GetAnchor();
 


More information about the Libreoffice-commits mailing list