[Libreoffice-commits] core.git: lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Thu Mar 1 20:28:43 UTC 2018


 lotuswordpro/source/filter/lwplayout.cxx |   20 +++++++++++++++-----
 lotuswordpro/source/filter/lwplayout.hxx |    1 +
 2 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit ad56a550864cbe86687abbea492af47b5ab5d7c6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 1 20:27:31 2018 +0000

    ofz#6640 avoid recurse to death
    
    Change-Id: Ia798636a5b4013753a268fff68915ec56c384e5f

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index e753d4722725..014ff5563d16 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -83,6 +83,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
     , m_bGettingExtMarginsValue(false)
     , m_bGettingUsePrinterSettings(false)
     , m_bGettingUseWhen(false)
+    , m_bGettingStyleLayout(false)
     , m_nAttributes(0)
     , m_nAttributes2(0)
     , m_nAttributes3(0)
@@ -364,13 +365,22 @@ bool LwpVirtualLayout::NoContentReference()
 
 bool LwpVirtualLayout::IsStyleLayout()
 {
+    if (m_bGettingStyleLayout)
+        throw std::runtime_error("recursion in layout");
+    m_bGettingStyleLayout = true;
+
+    bool bRet = false;
     if (m_nAttributes3 & STYLE3_STYLELAYOUT)
-        return true;
+        bRet = true;
+    else
+    {
+        rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+        if (xParent.is())
+            bRet = xParent->IsStyleLayout();
+    }
 
-    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
-    if (xParent.is())
-        return xParent->IsStyleLayout();
-    return false;
+    m_bGettingStyleLayout = false;
+    return bRet;
 }
 
 /**
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 5c6a5563a27c..94adf4ee6813 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -228,6 +228,7 @@ protected:
     bool m_bGettingExtMarginsValue;
     bool m_bGettingUsePrinterSettings;
     bool m_bGettingUseWhen;
+    bool m_bGettingStyleLayout;
     sal_uInt32 m_nAttributes;
     sal_uInt32 m_nAttributes2;
     sal_uInt32 m_nAttributes3;


More information about the Libreoffice-commits mailing list