diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-10 19:51:41 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-05-17 19:09:04 +0200 |
commit | 7d20dc2ca69711c61fb1593ad85ccdef282c978d (patch) | |
tree | 17bf721117efc365ca81a6ea624d9d77b634f1a7 /sw | |
parent | 6ee57b39ba912f0902714d8c4d1a267511a3c6ca (diff) |
sw: fix assert in SwObjectFormatterTextFrame
sw/source/core/layout/objectformattertxtfrm.cxx:237: virtual bool SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool): Assertion `GetPageFrame().GetPhyPageNum() == GetPgNumOfCollected(nIdx)' failed.
The problem is that there are multiple (9) flys on text frame 324.
In the loop in CalcContent(), frame 324 starts out on page 13, then
with the first/second fly moves to page 12, then with the 3rd fly moves
forward to page 13 - but the pPageFrame that is passed to
SwObjectFormatter::FormatObj() was fetched outside of the loop.
(regression from commit c799de145f7e289f31e3669646e5bd12814e6c5e
and commit 533a998e540b0f04068c876dde0e74adc3f79c93)
Change-Id: Iae573900b4b6558634bfed161e5c95bd5ba27151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121924
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/layout/data/tdf123163-1.docx | bin | 0 -> 341105 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/qa/extras/layout/data/tdf123163-1.docx b/sw/qa/extras/layout/data/tdf123163-1.docx Binary files differnew file mode 100644 index 000000000000..3f8865cb49b1 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf123163-1.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 1fb7157f3ec0..cca5636d933c 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3470,6 +3470,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116501) createSwDoc(DATA_DIRECTORY, "tdf116501.odt"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123163) +{ + //just care it doesn't assert + createSwDoc(DATA_DIRECTORY, "tdf123163-1.docx"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testAbi11870) { //just care it doesn't assert diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 8de89c9b7629..afe143f158a9 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1539,11 +1539,13 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) { bool bAgain = false; bool bRestartLayoutProcess = false; - SwPageFrame* pPageFrame = pFrame->FindPageFrame(); size_t nCnt = pFrame->GetDrawObjs()->size(); size_t i = 0; while ( i < nCnt ) { + // pFrame can move to a different page in FormatObj() + SwPageFrame *const pPageFrame = pFrame->FindPageFrame(); + // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i]; assert(pAnchoredObj); |