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

Caolán McNamara caolanm at redhat.com
Mon Feb 27 16:44:54 UTC 2017


 lotuswordpro/source/filter/lwpfribmark.cxx |   30 +++++++++++++----------------
 lotuswordpro/source/filter/lwpfribmark.hxx |    4 +--
 2 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 8eae0f2ee89558bdc00069ccea2679ff941b6307
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 27 16:43:48 2017 +0000

    fix leak
    
    Change-Id: Ie352e9b7fe52d41492141ebba9b5d332960dadd5

diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index a71a392..a37d254 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -146,27 +146,25 @@ void  LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
     LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
     if (type == MARKER_START)
     {
-        XFBookmarkStart* pMarkStart = new XFBookmarkStart;
-        pMarkStart->SetDivision(sDivision);
-        pMarkStart->SetName(name);
-        pMarkMgr->AddXFBookmarkStart(name,pMarkStart);//add to map
-        m_pStart = pMarkStart;
+        rtl::Reference<XFBookmarkStart> xMarkStart(new XFBookmarkStart);
+        xMarkStart->SetDivision(sDivision);
+        xMarkStart->SetName(name);
+        pMarkMgr->AddXFBookmarkStart(name, xMarkStart.get());//add to map
+        m_xStart = xMarkStart;
     }
     else if(type == MARKER_END)
     {
-        XFBookmarkEnd* pMarkEnd = new XFBookmarkEnd;
-        pMarkEnd->SetDivision(sDivision);
-        pMarkEnd->SetName(name);
-        pMarkMgr->AddXFBookmarkEnd(name,pMarkEnd);  //add to map
-        m_pEnd = pMarkEnd;
+        rtl::Reference<XFBookmarkEnd> xMarkEnd(new XFBookmarkEnd);
+        xMarkEnd->SetDivision(sDivision);
+        xMarkEnd->SetName(name);
+        pMarkMgr->AddXFBookmarkEnd(name, xMarkEnd.get());  //add to map
+        m_xEnd = xMarkEnd;
     }
 }
 
 LwpFribBookMark::LwpFribBookMark(LwpPara* pPara )
     : LwpFrib(pPara)
     , m_nType(0)
-    , m_pStart(nullptr)
-    , m_pEnd(nullptr)
 {
 }
 
@@ -185,13 +183,13 @@ void LwpFribBookMark::XFConvert(XFContentContainer* pXFPara)
 {
     sal_uInt8 type = GetType();
 
-    if (type == MARKER_START && m_pStart)
+    if (type == MARKER_START && m_xStart)
     {
-        pXFPara->Add(m_pStart);
+        pXFPara->Add(m_xStart.get());
     }
-    else if(type == MARKER_END && m_pEnd)
+    else if(type == MARKER_END && m_xEnd)
     {
-        pXFPara->Add(m_pEnd);
+        pXFPara->Add(m_xEnd.get());
     }
 }
 
diff --git a/lotuswordpro/source/filter/lwpfribmark.hxx b/lotuswordpro/source/filter/lwpfribmark.hxx
index a534f8f..45f7aee 100644
--- a/lotuswordpro/source/filter/lwpfribmark.hxx
+++ b/lotuswordpro/source/filter/lwpfribmark.hxx
@@ -95,8 +95,8 @@ public:
 private:
     sal_uInt8 m_nType;
     LwpObjectID m_objMarker;
-    XFBookmarkStart* m_pStart;
-    XFBookmarkEnd* m_pEnd;
+    rtl::Reference<XFBookmarkStart> m_xStart;
+    rtl::Reference<XFBookmarkEnd> m_xEnd;
 };
 
 class LwpFribField : public LwpFrib


More information about the Libreoffice-commits mailing list