diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-02-12 23:33:36 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-02-12 23:39:11 +0100 |
commit | cf91483690291272f48ff95c1aebd165da8ae4f0 (patch) | |
tree | 236f13b07e6f0cf1fd413a5b43cd34007966850a /sw | |
parent | 2b60321b21ff9ada64576f5711950b616b8a25ba (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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 5 |
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(); |