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

Caolán McNamara caolanm at redhat.com
Wed Mar 1 11:55:14 UTC 2017


 lotuswordpro/source/filter/lwpframelayout.cxx |   44 +++++++++++++-------------
 lotuswordpro/source/filter/lwpframelayout.hxx |    2 -
 lotuswordpro/source/filter/lwptablelayout.cxx |    4 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit a75439fe0f2e54781e6344b4b2db1a0a02a94c76
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 1 11:53:50 2017 +0000

    fix leak
    
    Change-Id: I7f87bf07e50baffd463d4429186928642bdf73b3

diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index a1cb935..c4de863 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -83,26 +83,26 @@ LwpFrame::~LwpFrame()
 * @param:  pFrameStyle - Frame Style object
 *
 */
-void  LwpFrame::RegisterStyle(XFFrameStyle* pFrameStyle)
+void LwpFrame::RegisterStyle(std::unique_ptr<XFFrameStyle>& rFrameStyle)
 {
-    ApplyWrapType(pFrameStyle);
-    ApplyMargins(pFrameStyle);
-    ApplyPadding(pFrameStyle);
-    ApplyBorders(pFrameStyle);
-    ApplyColumns(pFrameStyle);
-    ApplyShadow(pFrameStyle);
-    ApplyBackGround(pFrameStyle);
-    ApplyWatermark(pFrameStyle);
-//  ApplyBackColor(pFrameStyle);
-    ApplyProtect(pFrameStyle);
-    ApplyTextDir(pFrameStyle);
-    ApplyPosType(pFrameStyle);
-
-    pFrameStyle->SetStyleName(m_pLayout->GetName().str());
+    ApplyWrapType(rFrameStyle.get());
+    ApplyMargins(rFrameStyle.get());
+    ApplyPadding(rFrameStyle.get());
+    ApplyBorders(rFrameStyle.get());
+    ApplyColumns(rFrameStyle.get());
+    ApplyShadow(rFrameStyle.get());
+    ApplyBackGround(rFrameStyle.get());
+    ApplyWatermark(rFrameStyle.get());
+    ApplyProtect(rFrameStyle.get());
+    ApplyTextDir(rFrameStyle.get());
+    ApplyPosType(rFrameStyle.get());
+
+    rFrameStyle->SetStyleName(m_pLayout->GetName().str());
     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
-    m_StyleName = pXFStyleManager->AddStyle(pFrameStyle).m_pStyle->GetStyleName();
+    m_StyleName = pXFStyleManager->AddStyle(rFrameStyle.release()).m_pStyle->GetStyleName();
     m_pLayout->SetStyleName(m_StyleName);
 }
+
 /**
 * @descr:  parse frame and set frame properties
 * @param:   pXFFrame - XFFrame object
@@ -856,9 +856,9 @@ void  LwpFrameLayout::RegisterStyle()
         return;
 
     //register frame style
-    XFFrameStyle* pFrameStyle = new XFFrameStyle();
-    m_pFrame.reset( new LwpFrame(this) );
-    m_pFrame->RegisterStyle(pFrameStyle);
+    std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+    m_pFrame.reset(new LwpFrame(this));
+    m_pFrame->RegisterStyle(xFrameStyle);
 
     //register content style
     rtl::Reference<LwpObject> content = m_Content.obj();
@@ -1046,9 +1046,9 @@ void LwpGroupLayout::RegisterStyle()
         return;
 
     //register frame style
-    XFFrameStyle* pFrameStyle = new XFFrameStyle();
-    m_pFrame.reset( new LwpFrame(this) );
-    m_pFrame->RegisterStyle(pFrameStyle);
+    std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+    m_pFrame.reset(new LwpFrame(this));
+    m_pFrame->RegisterStyle(xFrameStyle);
 
     //register child frame style
     RegisterChildStyle();
diff --git a/lotuswordpro/source/filter/lwpframelayout.hxx b/lotuswordpro/source/filter/lwpframelayout.hxx
index 9575687..527e5fb 100644
--- a/lotuswordpro/source/filter/lwpframelayout.hxx
+++ b/lotuswordpro/source/filter/lwpframelayout.hxx
@@ -74,7 +74,7 @@ class LwpFrame
 public:
     explicit LwpFrame(LwpPlacableLayout* pLayout);
     ~LwpFrame();
-    void RegisterStyle(XFFrameStyle* pFrameStyle);
+    void RegisterStyle(std::unique_ptr<XFFrameStyle>& rFrameStyle);
     void Parse(XFFrame* pXFFrame, sal_Int32 nPageNo);
     void XFConvert(XFContentContainer* pCont);
 private:
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index f690daf..7973803 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -410,8 +410,8 @@ void  LwpSuperTableLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 n
  */
 void  LwpSuperTableLayout::RegisterFrameStyle()
 {
-    XFFrameStyle* pFrameStyle = new XFFrameStyle();
-    m_pFrame->RegisterStyle(pFrameStyle);
+    std::unique_ptr<XFFrameStyle> xFrameStyle(new XFFrameStyle);
+    m_pFrame->RegisterStyle(xFrameStyle);
 }
 
 LwpTableLayout::LwpTableLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)


More information about the Libreoffice-commits mailing list