Kaydet (Commit) faef7e6f authored tarafından Caolán McNamara's avatar Caolán McNamara

infinite regress

Change-Id: I7f716d2273115284769d580165fbfa21c1db541b
Reviewed-on: https://gerrit.libreoffice.org/49422Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7116b9cc
...@@ -74,6 +74,7 @@ LwpDocument::LwpDocument(LwpObjectHeader const & objHdr, LwpSvStream* pStrm) ...@@ -74,6 +74,7 @@ LwpDocument::LwpDocument(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm) : LwpDLNFPVList(objHdr, pStrm)
, m_pOwnedFoundry(nullptr) , m_pOwnedFoundry(nullptr)
, m_bGettingFirstDivisionWithContentsThatIsNotOLE(false) , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
, m_bGettingPreviousDivisionWithContents(false)
, m_nFlags(0) , m_nFlags(0)
, m_nPersistentFlags(0) , m_nPersistentFlags(0)
, m_pLnOpts(nullptr) , m_pLnOpts(nullptr)
...@@ -526,17 +527,20 @@ LwpDocument* LwpDocument::GetPreviousDivision() ...@@ -526,17 +527,20 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/** /**
* @descr Get previous division which has contents, copy from lwp source code * @descr Get previous division which has contents, copy from lwp source code
*/ */
LwpDocument* LwpDocument::GetPreviousDivisionWithContents() LwpDocument* LwpDocument::GetPreviousDivisionWithContents()
{ {
if(GetPreviousDivision()) if (m_bGettingPreviousDivisionWithContents)
{ throw std::runtime_error("recursion in page divisions");
LwpDocument* pDoc = GetPreviousDivision()->GetLastDivisionWithContents(); m_bGettingPreviousDivisionWithContents = true;
if (pDoc) LwpDocument* pRet = nullptr;
return pDoc;
} if (GetPreviousDivision())
if(GetParentDivision()) pRet = GetPreviousDivision()->GetLastDivisionWithContents();
return GetParentDivision()->GetPreviousDivisionWithContents(); if (!pRet && GetParentDivision())
return nullptr; pRet = GetParentDivision()->GetPreviousDivisionWithContents();
m_bGettingPreviousDivisionWithContents = false;
return pRet;
} }
/** /**
* @descr Get last division which has contents, copy from lwp source code * @descr Get last division which has contents, copy from lwp source code
......
...@@ -85,6 +85,7 @@ public: ...@@ -85,6 +85,7 @@ public:
private: private:
LwpFoundry* m_pOwnedFoundry; LwpFoundry* m_pOwnedFoundry;
bool m_bGettingFirstDivisionWithContentsThatIsNotOLE; bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
bool m_bGettingPreviousDivisionWithContents;
//Data members in file format //Data members in file format
LwpObjectID m_DocSockID; LwpObjectID m_DocSockID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment