summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-02-12 23:33:36 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-16 11:34:44 +0000
commit77aa8f92aab6a66ca2186efd2e4cbfc0d1c9f0e8 (patch)
tree21e0a06abf1b307440e740f4a3ee1502ba2f627a
parent83f6dca40ff36697b426458962fa09564e5551bb (diff)
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 <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/core/layout/pagechg.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 42ae8acbe5d9..1c9e8033c8f1 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();