Fix infinite loop in sw_ooxmlexport17 unit test on macOS Intel

When running the sw_ooxmlexport17 unit test on slower macOS Intel
machines, This loop will never end even after 1M+ loops so set a
maximum number of loops like is done in the nested while loops.

Change-Id: If3a6140e03f21f4a16f6d90be7988c28c8f36753
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143947
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Patrick Luby
2022-12-13 06:08:40 +00:00
committed by Noel Grandin
parent 4bcf6d9c90
commit d491791dad
+12
View File
@@ -500,8 +500,20 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
return bAgain;
};
int nOuterLoopControlRuns = 0;
const int nOutermoopControlMax = 10000;
while ( (pPage && !IsInterrupt()) || m_nCheckPageNum != USHRT_MAX )
{
// Fix infinite loop in sw_ooxmlexport17 unit test
// When running the sw_ooxmlexport17 unit test on slower macOS Intel
// machines, This loop will never end even after 1M+ loops so set a
// maximum number of loops like is done in the nested while loops.
if (++nOuterLoopControlRuns > nOutermoopControlMax)
{
SAL_WARN("sw", "SwLayAction::InternalAction has run too many loops");
m_bInterrupt = true;
}
// note: this is the only place that consumes and resets m_nCheckPageNum
if ((IsInterrupt() || !pPage) && m_nCheckPageNum != USHRT_MAX)
{