summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-28 12:42:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-02-28 12:42:41 +0000
commit214ef61b37c7e05414fa975bd21643220f2d4140 (patch)
tree4c74dc1d166ef53264d68a835072163db6bb933a /lotuswordpro
parent11c92df5e61aba0e37a4b3d6e5aaace084812d71 (diff)
fix leak
Change-Id: Id501339e1576277655c53e0cf0d172947640d64e
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx23
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.hxx14
2 files changed, 14 insertions, 23 deletions
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 6591db06beda..6c22b9377465 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 72be999ce84d..2f2ac1d96466 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);