summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-06 20:37:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-06 22:14:59 +0100
commitd38674f3b5b6c97be5f8822f52301e29d677ed1e (patch)
tree059c59e4da2514b622506cac3b9d5c41154d1e0e
parent37c719d92b8645aef68925c2dab669a4d1d83e85 (diff)
ofz#4548 infinite regress in GetUsePrinterSettings
Change-Id: Iebd51c8724eebb942af45f3be24718a7a1278183 Reviewed-on: https://gerrit.libreoffice.org/45991 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx15
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx1
2 files changed, 13 insertions, 3 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index cdaa7ab7dfa3..acd913cd8489 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -81,6 +81,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
, m_bGettingIsProtected(false)
, m_bGettingMarginsValue(false)
, m_bGettingExtMarginsValue(false)
+ , m_bGettingUsePrinterSettings(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
@@ -1405,19 +1406,27 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage()
*/
bool LwpMiddleLayout::GetUsePrinterSettings()
{
+ if (m_bGettingUsePrinterSettings)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingUsePrinterSettings = true;
+
+ bool bRet = false;
+
if(m_nOverrideFlag & OVER_SIZE)
{
- return (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
+ bRet = (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
}
else
{
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
{
- return pLay->GetUsePrinterSettings();
+ bRet = pLay->GetUsePrinterSettings();
}
}
- return false;
+
+ m_bGettingMarginsValue = false;
+ return bRet;
}
//Check whether there are contents in the layout
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index efff5f62fd07..cd84af5b380b 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -226,6 +226,7 @@ protected:
bool m_bGettingIsProtected;
bool m_bGettingMarginsValue;
bool m_bGettingExtMarginsValue;
+ bool m_bGettingUsePrinterSettings;
sal_uInt32 m_nAttributes;
sal_uInt32 m_nAttributes2;
sal_uInt32 m_nAttributes3;