summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-28 09:13:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-28 09:19:21 +0000
commite07a1a5d6957dbb4dc19cb4d274406e8e075c729 (patch)
tree27d1580242abb462c6ce116a5f8e46a8d044be1b
parent756c9f2317605e39d9cb058e650962acd2d81739 (diff)
ofz#6602 infinite recursion
Change-Id: I358708f606655bcd0df948fd2e01725c706880c7
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx16
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx1
2 files changed, 15 insertions, 2 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index df43d93a81e2..931539851d46 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -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
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 50dbcdf57197..5c6a5563a27c 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -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;