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

Caolán McNamara caolanm at redhat.com
Tue Feb 28 12:03:05 UTC 2017


 lotuswordpro/source/filter/lwpstory.cxx |   19 +++++++------------
 lotuswordpro/source/filter/lwpstory.hxx |    2 +-
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 06206252f43c388e781f7bf1665604da108f14c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 28 12:01:29 2017 +0000

    fix leak
    
    Change-Id: I724c6e50392d70acd847c733e09a959c08c8c790

diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 3038348..6a700be 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -75,7 +75,6 @@ LwpStory::LwpStory(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     , m_pTabLayout(nullptr)
     , m_bDropcap(false)
     , m_pHyperlinkMgr(new LwpHyperlinkMgr)
-    , m_pXFContainer(nullptr)
 {
 }
 
@@ -141,11 +140,10 @@ void LwpStory::RegisterStyle()
 
 void LwpStory::Parse(IXFStream* pOutputStream)
 {
-    m_pXFContainer = new XFContentContainer;
-    XFConvert(m_pXFContainer);
-    m_pXFContainer->ToXml(pOutputStream);
-    delete m_pXFContainer;
-    m_pXFContainer = nullptr;
+    m_xXFContainer.set(new XFContentContainer);
+    XFConvert(m_xXFContainer.get());
+    m_xXFContainer->ToXml(pOutputStream);
+    m_xXFContainer.clear();
 }
 
 /**************************************************************************
@@ -392,16 +390,13 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
 
 void LwpStory::AddXFContent(XFContent* pContent)
 {
-    if(m_pXFContainer)
-        m_pXFContainer->Add(pContent);
+    if (m_xXFContainer)
+        m_xXFContainer->Add(pContent);
 }
 
 XFContentContainer* LwpStory::GetXFContent()
 {
-    if(m_pXFContainer)
-        return m_pXFContainer;
-    else
-        return nullptr;
+    return m_xXFContainer.get();
 }
 
 LwpPara* LwpStory::GetLastParaOfPreviousStory()
diff --git a/lotuswordpro/source/filter/lwpstory.hxx b/lotuswordpro/source/filter/lwpstory.hxx
index 39a5b22..f4c421b 100644
--- a/lotuswordpro/source/filter/lwpstory.hxx
+++ b/lotuswordpro/source/filter/lwpstory.hxx
@@ -90,7 +90,7 @@ private:
     std::unique_ptr<LwpHyperlinkMgr> m_pHyperlinkMgr;
     OUString m_CurrSectionName;
 
-    XFContentContainer* m_pXFContainer;
+    rtl::Reference<XFContentContainer> m_xXFContainer;
 
 protected:
     void Read() override;


More information about the Libreoffice-commits mailing list