[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Thu Feb 8 20:52:41 UTC 2018
lotuswordpro/source/filter/lwpdoc.cxx | 24 ++++++++++++++----------
lotuswordpro/source/filter/lwpdoc.hxx | 1 +
2 files changed, 15 insertions(+), 10 deletions(-)
New commits:
commit faef7e6f89da31040c3a1f51cfa2356e8711935f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 8 11:34:15 2018 +0000
infinite regress
Change-Id: I7f716d2273115284769d580165fbfa21c1db541b
Reviewed-on: https://gerrit.libreoffice.org/49422
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 27db9a01978d..7a0165191daf 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -74,6 +74,7 @@ LwpDocument::LwpDocument(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
, m_pOwnedFoundry(nullptr)
, m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
+ , m_bGettingPreviousDivisionWithContents(false)
, m_nFlags(0)
, m_nPersistentFlags(0)
, m_pLnOpts(nullptr)
@@ -526,17 +527,20 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/**
* @descr Get previous division which has contents, copy from lwp source code
*/
- LwpDocument* LwpDocument::GetPreviousDivisionWithContents()
+LwpDocument* LwpDocument::GetPreviousDivisionWithContents()
{
- if(GetPreviousDivision())
- {
- LwpDocument* pDoc = GetPreviousDivision()->GetLastDivisionWithContents();
- if (pDoc)
- return pDoc;
- }
- if(GetParentDivision())
- return GetParentDivision()->GetPreviousDivisionWithContents();
- return nullptr;
+ if (m_bGettingPreviousDivisionWithContents)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingPreviousDivisionWithContents = true;
+ LwpDocument* pRet = nullptr;
+
+ if (GetPreviousDivision())
+ pRet = GetPreviousDivision()->GetLastDivisionWithContents();
+ if (!pRet && GetParentDivision())
+ pRet = GetParentDivision()->GetPreviousDivisionWithContents();
+
+ m_bGettingPreviousDivisionWithContents = false;
+ return pRet;
}
/**
* @descr Get last division which has contents, copy from lwp source code
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
index 03b7c143afc6..4f9b8f9ac56f 100644
--- a/lotuswordpro/source/filter/lwpdoc.hxx
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -85,6 +85,7 @@ public:
private:
LwpFoundry* m_pOwnedFoundry;
bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
+ bool m_bGettingPreviousDivisionWithContents;
//Data members in file format
LwpObjectID m_DocSockID;
More information about the Libreoffice-commits
mailing list