[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Thu Feb 8 10:06:43 UTC 2018
lotuswordpro/source/filter/lwplayout.cxx | 19 +++++++++++++------
lotuswordpro/source/filter/lwplayout.hxx | 2 ++
2 files changed, 15 insertions(+), 6 deletions(-)
New commits:
commit f9826620aae0f9f9fb1dd30216e6be317ecb103b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 8 10:01:06 2018 +0000
ofz#6104 guard against self recursive GetShadow
Change-Id: If1cf0ef365f78665cc5b9f5f1ea53e82b531f9b0
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index c3aae4ee1369..5dc583dce675 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1422,9 +1422,11 @@ bool LwpMiddleLayout::HasContent()
return content.is();
}
-LwpLayout::LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) :
- LwpMiddleLayout(objHdr, pStrm)
-{}
+LwpLayout::LwpLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpMiddleLayout(objHdr, pStrm)
+ , m_bGettingShadow(false)
+{
+}
LwpLayout::~LwpLayout()
{
@@ -1813,20 +1815,25 @@ bool LwpLayout::IsUseOnPage()
*/
LwpShadow* LwpLayout::GetShadow()
{
+ if (m_bGettingShadow)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingShadow = true;
+ LwpShadow* pRet = nullptr;
if(m_nOverrideFlag & OVER_SHADOW)
{
LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get());
- return pLayoutShadow ? &pLayoutShadow->GetShadow() : nullptr;
+ pRet = pLayoutShadow ? &pLayoutShadow->GetShadow() : nullptr;
}
else
{
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
{
- return pLay->GetShadow();
+ pRet = pLay->GetShadow();
}
}
- return nullptr;
+ m_bGettingShadow = false;
+ return pRet;
}
/**
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 3c900b4d8a6d..a0f6ef868da3 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -415,6 +415,8 @@ public:
class LwpLayout : public LwpMiddleLayout
{
+private:
+ bool m_bGettingShadow;
public:
LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm );
virtual ~LwpLayout() override;
More information about the Libreoffice-commits
mailing list