[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Tue Feb 28 12:43:37 UTC 2017
lotuswordpro/source/filter/lwpfoundry.cxx | 23 +++++++----------------
lotuswordpro/source/filter/lwpfoundry.hxx | 14 +++++++-------
2 files changed, 14 insertions(+), 23 deletions(-)
New commits:
commit 214ef61b37c7e05414fa975bd21643220f2d4140
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 28 12:42:41 2017 +0000
fix leak
Change-Id: Id501339e1576277655c53e0cf0d172947640d64e
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 6591db0..6c22b93 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -72,28 +72,20 @@
#include "xfilter/xfstylemanager.hxx"
#include "lwplayout.hxx"
-
#include <osl/diagnose.h>
-
LwpFoundry::LwpFoundry(LwpObjectStream *pStrm, LwpDocument* pDoc)
: m_pDoc(pDoc)
, m_bRegisteredAll(false)
- , m_pPieceMgr(nullptr)
- , m_pStyleMgr(nullptr)
{
Read(pStrm);
- m_pDropcapMgr = new LwpDropcapMgr;
- m_pBulletStyleMgr = new LwpBulletStyleMgr();
- m_pBulletStyleMgr->SetFoundry(this);
+ m_xDropcapMgr.reset(new LwpDropcapMgr);
+ m_xBulletStyleMgr.reset(new LwpBulletStyleMgr);
+ m_xBulletStyleMgr->SetFoundry(this);
}
LwpFoundry::~LwpFoundry()
{
- delete m_pPieceMgr;
- delete m_pStyleMgr;
- delete m_pDropcapMgr;
- delete m_pBulletStyleMgr;
}
void LwpFoundry::Read(LwpObjectStream *pStrm)
@@ -132,9 +124,8 @@ void LwpFoundry::Read(LwpObjectStream *pStrm)
if (!m_pDoc->IsChildDoc() && LwpFileHeader::m_nFileRevision >= 0x000B)
{
- m_pPieceMgr = new LwpPieceManager();
-
- m_pPieceMgr->Read(pStrm);
+ m_xPieceMgr.reset(new LwpPieceManager);
+ m_xPieceMgr->Read(pStrm);
}
if( LwpFileHeader::m_nFileRevision >= 0x000B)
@@ -148,8 +139,8 @@ void LwpFoundry::Read(LwpObjectStream *pStrm)
}
pStrm->SkipExtra();
- m_pStyleMgr = new LwpStyleManager();
- m_pStyleMgr->SetFoundry(this);
+ m_xStyleMgr.reset(new LwpStyleManager);
+ m_xStyleMgr->SetFoundry(this);
}
void LwpFoundry::ReadStyles(LwpObjectStream *pStrm)
diff --git a/lotuswordpro/source/filter/lwpfoundry.hxx b/lotuswordpro/source/filter/lwpfoundry.hxx
index 72be999..2f2ac1d 100644
--- a/lotuswordpro/source/filter/lwpfoundry.hxx
+++ b/lotuswordpro/source/filter/lwpfoundry.hxx
@@ -240,7 +240,7 @@ private: //file members
LwpContentManager m_ContentMgr;
LwpFontManager m_FontMgr;
- LwpPieceManager* m_pPieceMgr;
+ std::unique_ptr<LwpPieceManager> m_xPieceMgr;
LwpObjectID m_DftDropCapStyle;
LwpObjectID m_DftHeaderStyle;
@@ -259,16 +259,16 @@ public:
inline LwpNumberManager& GetNumberManager() { return m_NumMgr;}
LwpObjectID * GetDefaultTextStyle() ;
private:
- LwpStyleManager* m_pStyleMgr;
- LwpDropcapMgr* m_pDropcapMgr;
- LwpBulletStyleMgr* m_pBulletStyleMgr;
+ std::unique_ptr<LwpStyleManager> m_xStyleMgr;
+ std::unique_ptr<LwpDropcapMgr> m_xDropcapMgr;
+ std::unique_ptr<LwpBulletStyleMgr> m_xBulletStyleMgr;
public:
- inline LwpStyleManager* GetStyleManager() { return m_pStyleMgr;}
+ LwpStyleManager* GetStyleManager() { return m_xStyleMgr.get(); }
LwpBookMark* GetBookMark(LwpObjectID objMarker);
- LwpDropcapMgr* GetDropcapMgr(){return m_pDropcapMgr;}
+ LwpDropcapMgr* GetDropcapMgr() { return m_xDropcapMgr.get(); }
LwpContent* EnumContents(LwpContent* pContent);
LwpSection* EnumSections(LwpSection* pSection);
- LwpBulletStyleMgr* GetBulletStyleMgr(){return m_pBulletStyleMgr;}
+ LwpBulletStyleMgr* GetBulletStyleMgr() { return m_xBulletStyleMgr.get(); }
LwpObjectID* FindParaStyleByName(const OUString& name);
OUString FindActuralStyleName(const OUString& name);
More information about the Libreoffice-commits
mailing list