[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Oct 12 00:08:57 PDT 2015
sw/qa/extras/ooxmlimport/data/tdf89165.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 5 +++++
sw/source/core/layout/hffrm.cxx | 12 +++++++++---
3 files changed, 14 insertions(+), 3 deletions(-)
New commits:
commit 51438e87d0e17a4cc3c991165d22c740b3ac1fc2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Oct 12 09:07:52 2015 +0200
tdf#89165 sw: looping layout in SwHeadFootFrm::FormatSize()
FormatObjsAtFrm() returns false, indicating that the result is not
perfect, and the caller hopes that formatting all children of the frame
again will help. Make sure that in case that assumption turns out to be false, we at
least do not loop.
The loop limit is enough to make the original i#43771 bugdoc still laid
out properly.
Change-Id: Ife9bd99a628a72edb922d04e05081971b6adf340
diff --git a/sw/qa/extras/ooxmlimport/data/tdf89165.docx b/sw/qa/extras/ooxmlimport/data/tdf89165.docx
new file mode 100644
index 0000000..a060ca4
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf89165.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 21f3034..c872e21 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2874,6 +2874,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf90810, "tdf90810short.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), static_cast<sal_Int32>(sFtnText.getLength()));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf89165, "tdf89165.docx")
+{
+ // This must not hang in layout
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index a189238..98fb929 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -246,6 +246,7 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
pFrm->_InvalidatePos();
aOldFooterPrtPos = Frm().Pos() + Prt().Pos();
}
+ int nLoopControl = 0;
while( pFrm )
{
pFrm->Calc(getRootFrm()->GetCurrShell()->GetOut());
@@ -263,9 +264,14 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
if ( !SwObjectFormatter::FormatObjsAtFrm( *pFrm,
*(pFrm->FindPageFrm()) ) )
{
- // restart format with first content
- pFrm = Lower();
- continue;
+ if (nLoopControl++ < 20)
+ {
+ // restart format with first content
+ pFrm = Lower();
+ continue;
+ }
+ else
+ SAL_WARN("sw", "SwHeadFootFrm::FormatSize: loop detection triggered");
}
}
pFrm = pFrm->GetNext();
More information about the Libreoffice-commits
mailing list