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

Caolán McNamara caolanm at redhat.com
Sun Dec 13 08:03:45 PST 2015


 lotuswordpro/source/filter/lwpstory.cxx |   41 +++++++++-----------------------
 1 file changed, 12 insertions(+), 29 deletions(-)

New commits:
commit 0876868a14c7d139ed2a79ece989c84239a2c853
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 13 16:03:07 2015 +0000

    use more references to fix life cycles
    
    Change-Id: I54931f0dccabb2d9a58cc92ef5ebf3469f93f03c

diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 908cf3e..53d76a9 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -100,15 +100,15 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
     XFConvertFrameInFrame(pCont);
     //process para list
     XFContentContainer* pParaCont = pCont;
-    LwpPara* pPara = dynamic_cast<LwpPara*> ( GetFirstPara().obj().get() );
-    while(pPara)
+    rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+    while (xPara.is())
     {
-        pPara->SetFoundry(m_pFoundry);
-        pPara->XFConvert(pParaCont);
+        xPara->SetFoundry(m_pFoundry);
+        xPara->XFConvert(pParaCont);
 
         //Get the xfcontainer for the next para
-        pParaCont = pPara->GetXFContainer();
-        pPara = dynamic_cast<LwpPara*> ( pPara->GetNext().obj().get() );
+        pParaCont = xPara->GetXFContainer();
+        xPara.set(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
     }
 
     //process frame which anchor is to cell after converter all the para
@@ -116,15 +116,15 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
     XFConvertFrameInHeaderFooter(pCont);
 
     //Release Lwp Objects
-    LwpPara* pCur = dynamic_cast<LwpPara*> (GetFirstPara().obj().get());
-    LwpPara* pNext;
-    while(pCur)
+    rtl::Reference<LwpPara> xCur(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+    rtl::Reference<LwpPara> xNext;
+    while (xCur.is())
     {
-        pNext = dynamic_cast<LwpPara*> ( pCur->GetNext().obj().get() );
+        xNext.set(dynamic_cast<LwpPara*>(xCur->GetNext().obj().get()));
         LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
         LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
-        pObjMgr->ReleaseObject(pCur->GetObjectID());
-        pCur = pNext;
+        pObjMgr->ReleaseObject(xCur->GetObjectID());
+        xCur = xNext;
     }
 }
 
@@ -146,23 +146,6 @@ void LwpStory::Parse(IXFStream* pOutputStream)
     m_pXFContainer->ToXml(pOutputStream);
     delete m_pXFContainer;
     m_pXFContainer = nullptr;
-
-    //It seems that, currently, we do not need to process the child story
-    /*LwpObject* pChildStory = GetFirstStory()->obj();
-    if(pChildStory)
-    {
-        pChildStory->SetFoundry(m_pFoundry);
-        pChildStory->Parse(pOutputStream);
-    }*/
-
-    //Don't process the next story
-/*  LwpObject* pNextStory = GetNextStory()->obj();
-    if(pNextStory)
-    {
-        pNextStory->SetFoundry(m_pFoundry);
-        pNextStory->Parse(pOutputStream);
-    }*/
-
 }
 
 #include "lwppagelayout.hxx"


More information about the Libreoffice-commits mailing list