Kaydet (Commit) e07a1a5d authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#6602 infinite recursion

Change-Id: I358708f606655bcd0df948fd2e01725c706880c7
üst 756c9f23
......@@ -82,6 +82,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
, m_bGettingMarginsValue(false)
, m_bGettingExtMarginsValue(false)
, m_bGettingUsePrinterSettings(false)
, m_bGettingUseWhen(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
......@@ -227,6 +228,12 @@ bool LwpVirtualLayout::IsComplex()
*/
LwpUseWhen* LwpVirtualLayout::GetUseWhen()
{
if (m_bGettingUseWhen)
throw std::runtime_error("recursion in layout");
m_bGettingUseWhen= true;
LwpUseWhen* pRet = nullptr;
/*
If we have a parent, and I'm not a page layout,
use my parents information.
......@@ -236,11 +243,16 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
//get parent
rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
if (xParent.is() && !xParent->IsHeader() && (xParent->GetLayoutType() != LWP_PAGE_LAYOUT))
return xParent->GetUseWhen();
pRet = xParent->GetUseWhen();
}
return VirtualGetUseWhen();
if (!pRet)
pRet = VirtualGetUseWhen();
m_bGettingUseWhen = false;
return pRet;
}
/**
* @descr: Whether this layout is page layout or not
......
......@@ -227,6 +227,7 @@ protected:
bool m_bGettingMarginsValue;
bool m_bGettingExtMarginsValue;
bool m_bGettingUsePrinterSettings;
bool m_bGettingUseWhen;
sal_uInt32 m_nAttributes;
sal_uInt32 m_nAttributes2;
sal_uInt32 m_nAttributes3;
......
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