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

New commits:
commit 77aa8f92aab6a66ca2186efd2e4cbfc0d1c9f0e8
Author: Michael Stahl <mst...@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
    (cherry picked from commit cf91483690291272f48ff95c1aebd165da8ae4f0)
    Reviewed-on: https://gerrit.libreoffice.org/22338
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

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();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to