[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Tue Dec 19 22:41:12 UTC 2017
lotuswordpro/source/filter/lwplayout.cxx | 16 +++++++++++-----
lotuswordpro/source/filter/lwplayout.hxx | 1 +
2 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit aea7d5682ccfa886812baece60ece4ee296e8a69
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 19 09:18:54 2017 +0000
ofz#4689 avoid recurse to death
Change-Id: Ie578a767cd8646c4e67c302a67b46ce1f1637122
Reviewed-on: https://gerrit.libreoffice.org/46773
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index cb9a170159b3..7fd1060afaf2 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1948,6 +1948,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
: LwpLayout(objHdr, pStrm)
, m_bGettingWrapType(false)
+ , m_bGettingLayoutRelativity(false)
, m_nWrapType(0)
, m_nBuoyancy(0)
, m_nBaseLineOffset(0)
@@ -2027,11 +2028,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
*/
LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
{
- if(!m_LayRelativity.IsNull())
+ if (m_bGettingLayoutRelativity)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingLayoutRelativity = true;
+ LwpLayoutRelativity* pRet = nullptr;
+ if (!m_LayRelativity.IsNull())
{
- if(m_nOverrideFlag & OVER_PLACEMENT)
+ if (m_nOverrideFlag & OVER_PLACEMENT)
{
- return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
+ pRet = dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
}
}
else
@@ -2039,10 +2044,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
{
- return pLay->GetRelativityPiece();
+ pRet = pLay->GetRelativityPiece();
}
}
- return nullptr;
+ m_bGettingLayoutRelativity = false;
+ return pRet;
}
/**
* @descr: Get relative type
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 1c10f59f3feb..aba59615360b 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -497,6 +497,7 @@ protected:
void Read() override;
protected:
bool m_bGettingWrapType;
+ bool m_bGettingLayoutRelativity;
sal_uInt8 m_nWrapType;
sal_uInt8 m_nBuoyancy;
sal_Int32 m_nBaseLineOffset;
More information about the Libreoffice-commits
mailing list