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

ofz: better loop detect

Change-Id: I7c33d2a64a6b4968e8a83f53f5c893eb5ba268b7
Reviewed-on: https://gerrit.libreoffice.org/48415Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst c36547d1
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
#include <lwpobjfactory.hxx> #include <lwpobjfactory.hxx>
#include "lwppagelayout.hxx" #include "lwppagelayout.hxx"
#include <set>
LwpStory::LwpStory(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) LwpStory::LwpStory(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
: LwpContent(objHdr, pStrm) : LwpContent(objHdr, pStrm)
...@@ -100,15 +102,17 @@ void LwpStory::XFConvert(XFContentContainer* pCont) ...@@ -100,15 +102,17 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
//process para list //process para list
XFContentContainer* pParaCont = pCont; XFContentContainer* pParaCont = pCont;
rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get())); rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
std::set<LwpPara*> aConverted;
while (xPara.is()) while (xPara.is())
{ {
xPara->SetFoundry(m_pFoundry); xPara->SetFoundry(m_pFoundry);
xPara->XFConvert(pParaCont); xPara->XFConvert(pParaCont);
aConverted.insert(xPara.get());
//Get the xfcontainer for the next para //Get the xfcontainer for the next para
pParaCont = xPara->GetXFContainer(); pParaCont = xPara->GetXFContainer();
rtl::Reference<LwpPara> xNext(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get())); rtl::Reference<LwpPara> xNext(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
if (xPara == xNext) if (aConverted.find(xNext.get()) != aConverted.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
xPara = xNext; xPara = xNext;
} }
......
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