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

Caolán McNamara caolanm at redhat.com
Thu Jan 18 13:37:44 UTC 2018


 lotuswordpro/source/filter/lwppara.cxx |   29 +++++++++++++----------------
 lotuswordpro/source/filter/lwppara.hxx |   10 +++++-----
 2 files changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 714ba513d3079c36145ed18826141d54d72a1744
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 18 09:03:13 2018 +0000

    ofz#5462 Direct-leak
    
    Change-Id: Ic2b7d139ebb6e88fac5cf9f4cf8dbec26905bcdc
    Reviewed-on: https://gerrit.libreoffice.org/48097
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 0c9c59d6fd2d..d831268d8711 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -117,7 +117,6 @@ LwpPara::LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
     , m_nChars(0)
     , m_pDropcapLayout(nullptr)
     , m_BelowSpacing(0)
-    , m_pXFContainer(nullptr)
 {
 }
 
@@ -236,19 +235,18 @@ void LwpPara::Read()
 
 void LwpPara::Parse(IXFStream* pOutputStream)
 {
-    m_pXFContainer = new XFContentContainer;
-    XFConvert(m_pXFContainer);
-    if (!m_pXFContainer)
+    m_xXFContainer.set(new XFContentContainer);
+    XFConvert(m_xXFContainer.get());
+    if (!m_xXFContainer)
         return;
-    m_pXFContainer->ToXml(pOutputStream);
-    m_pXFContainer->Reset();
-    delete m_pXFContainer;
-    m_pXFContainer = nullptr;
+    m_xXFContainer->ToXml(pOutputStream);
+    m_xXFContainer->Reset();
+    m_xXFContainer.clear();
 }
 
 void LwpPara::XFConvert(XFContentContainer* pCont)
 {
-    m_pXFContainer = pCont;
+    m_xXFContainer.set(pCont);
 
     LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
 
@@ -272,19 +270,18 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
         XFSection* pSection = CreateXFSection();
         if (pStory)
             pStory->AddXFContent(pSection);
-        //pSection->Add(pPara);
-        m_pXFContainer = pSection;
+        m_xXFContainer.set(pSection);
     }
 
     if (m_bHasBullet && m_pSilverBullet)
     {
-        rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_pXFContainer);
+        rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_xXFContainer.get());
         if (xListItem)
         {
             xListItem->Add(pPara);
         }
     }
-    else if (m_pXFContainer)
+    else if (m_xXFContainer)
     {
         LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
         if (pBulletStyleMgr)
@@ -292,14 +289,14 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
             pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID());
             pBulletStyleMgr->SetContinueFlag(false);
         }
-        m_pXFContainer->Add(pPara);
+        m_xXFContainer->Add(pPara);
     }
 
     m_Fribs.SetXFPara(pPara);
     m_Fribs.XFConvert();
 
-    if (m_pBreaks && m_pXFContainer)
-        AddBreakAfter(m_pXFContainer);
+    if (m_pBreaks && m_xXFContainer)
+        AddBreakAfter(m_xXFContainer.get());
 }
 
 void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle)
diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx
index 2b662ea75204..c18b9dee9d03 100644
--- a/lotuswordpro/source/filter/lwppara.hxx
+++ b/lotuswordpro/source/filter/lwppara.hxx
@@ -231,7 +231,7 @@ protected:
     LwpDropcapLayout* m_pDropcapLayout;
     double m_BelowSpacing;
 
-    XFContentContainer* m_pXFContainer; //Current container for VO_PARA
+    rtl::Reference<XFContentContainer> m_xXFContainer; //Current container for VO_PARA
 
     enum
     {
@@ -309,7 +309,7 @@ inline LwpFribPtr& LwpPara::GetFribs()
 }
 inline XFContentContainer* LwpPara::GetXFContainer()
 {
-    return m_pXFContainer;
+    return m_xXFContainer.get();
 }
 inline const OUString& LwpPara::GetBulletStyleName() const
 {
@@ -317,13 +317,13 @@ inline const OUString& LwpPara::GetBulletStyleName() const
 }
 inline void LwpPara::AddXFContent(XFContent* pCont)
 {
-    if (!m_pXFContainer)
+    if (!m_xXFContainer)
         throw std::runtime_error("paragraph lacks container");
-    m_pXFContainer->Add(pCont);
+    m_xXFContainer->Add(pCont);
 }
 inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
 {
-    m_pXFContainer = pCont;
+    m_xXFContainer.set(pCont);
 }
 inline LwpIndentOverride* LwpPara::GetIndent()
 {


More information about the Libreoffice-commits mailing list