diff options
-rw-r--r-- | sw/qa/extras/layout/data/forcepoint99.html | bin | 0 -> 14034 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 4 |
5 files changed, 22 insertions, 5 deletions
diff --git a/sw/qa/extras/layout/data/forcepoint99.html b/sw/qa/extras/layout/data/forcepoint99.html Binary files differnew file mode 100644 index 000000000000..6eb36a616e26 --- /dev/null +++ b/sw/qa/extras/layout/data/forcepoint99.html diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 65308c42b77f..a788bd9171d1 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2561,6 +2561,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } +//just care it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint99) +{ + createSwWebDoc(DATA_DIRECTORY, "forcepoint99.html"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) { createSwDoc(DATA_DIRECTORY, "tdf128611.fodt"); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index ee8bec655455..2f978289a267 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -150,6 +150,16 @@ sal_uInt16 SwTextFormatter::GetFrameRstHeight() const return sal_uInt16( nHeight ); } +bool SwTextFormatter::ClearIfIsFirstOfBorderMerge(const SwLinePortion* pPortion) +{ + if (pPortion == m_pFirstOfBorderMerge) + { + m_pFirstOfBorderMerge = nullptr; + return true; + } + return false; +} + SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) { // Save values and initialize rInf @@ -278,11 +288,8 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) SwLinePortion* pNext = pPor->GetNextPortion(); while (pNext) { - if (pNext == m_pFirstOfBorderMerge) - { - m_pFirstOfBorderMerge = nullptr; + if (ClearIfIsFirstOfBorderMerge(pNext)) break; - } pNext = pNext->GetNextPortion(); } pPor->Truncate(); diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index bd986e4be324..d5f0fa550b51 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -238,6 +238,8 @@ public: * @param rInf contain information **/ void MergeCharacterBorder( SwLinePortion& rPortion, SwLinePortion const *pPrev, SwTextFormatInfo& rInf ); + + bool ClearIfIsFirstOfBorderMerge(SwLinePortion const *pPortion); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index e3b8f3bd6cf7..8e61614a6ef1 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -427,7 +427,9 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf ) if( !GetAscent() ) SetAscent( pPos->GetAscent() ); } - delete pLast->Cut( pPos ); + SwLinePortion* pPortion = pLast->Cut( pPos ); + rLine.ClearIfIsFirstOfBorderMerge(pPortion); + delete pPortion; pPos = pLast->GetNextPortion(); continue; } |