Kaydet (Commit) aea7d568 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Christian Lohmaier

ofz#4689 avoid recurse to death

Change-Id: Ie578a767cd8646c4e67c302a67b46ce1f1637122
Reviewed-on: https://gerrit.libreoffice.org/46773Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst 423addf8
...@@ -1948,6 +1948,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout() ...@@ -1948,6 +1948,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm )
: LwpLayout(objHdr, pStrm) : LwpLayout(objHdr, pStrm)
, m_bGettingWrapType(false) , m_bGettingWrapType(false)
, m_bGettingLayoutRelativity(false)
, m_nWrapType(0) , m_nWrapType(0)
, m_nBuoyancy(0) , m_nBuoyancy(0)
, m_nBaseLineOffset(0) , m_nBaseLineOffset(0)
...@@ -2027,11 +2028,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType() ...@@ -2027,11 +2028,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
*/ */
LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() 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 else
...@@ -2039,10 +2044,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() ...@@ -2039,10 +2044,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get())) 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 * @descr: Get relative type
......
...@@ -497,6 +497,7 @@ protected: ...@@ -497,6 +497,7 @@ protected:
void Read() override; void Read() override;
protected: protected:
bool m_bGettingWrapType; bool m_bGettingWrapType;
bool m_bGettingLayoutRelativity;
sal_uInt8 m_nWrapType; sal_uInt8 m_nWrapType;
sal_uInt8 m_nBuoyancy; sal_uInt8 m_nBuoyancy;
sal_Int32 m_nBaseLineOffset; sal_Int32 m_nBaseLineOffset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment