diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-18 09:03:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-01-18 14:37:09 +0100 |
commit | 714ba513d3079c36145ed18826141d54d72a1744 (patch) | |
tree | 94ac96c0158c0b14e9acdfd5201db53ecd8358f4 /lotuswordpro | |
parent | 8ff75a0bd02555c528f50eb7c045927b41dc3c36 (diff) |
ofz#5462 Direct-leak
Change-Id: Ic2b7d139ebb6e88fac5cf9f4cf8dbec26905bcdc
Reviewed-on: https://gerrit.libreoffice.org/48097
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwppara.cxx | 29 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwppara.hxx | 10 |
2 files changed, 18 insertions, 21 deletions
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index 0c9c59d6fd2d..d831268d8711 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -117,7 +117,6 @@ LwpPara::LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm) , m_nChars(0) , m_pDropcapLayout(nullptr) , m_BelowSpacing(0) - , m_pXFContainer(nullptr) { } @@ -236,19 +235,18 @@ void LwpPara::Read() void LwpPara::Parse(IXFStream* pOutputStream) { - m_pXFContainer = new XFContentContainer; - XFConvert(m_pXFContainer); - if (!m_pXFContainer) + m_xXFContainer.set(new XFContentContainer); + XFConvert(m_xXFContainer.get()); + if (!m_xXFContainer) return; - m_pXFContainer->ToXml(pOutputStream); - m_pXFContainer->Reset(); - delete m_pXFContainer; - m_pXFContainer = nullptr; + m_xXFContainer->ToXml(pOutputStream); + m_xXFContainer->Reset(); + m_xXFContainer.clear(); } void LwpPara::XFConvert(XFContentContainer* pCont) { - m_pXFContainer = pCont; + m_xXFContainer.set(pCont); LwpStory *pStory = dynamic_cast<LwpStory*>(m_Story.obj().get()); @@ -272,19 +270,18 @@ void LwpPara::XFConvert(XFContentContainer* pCont) XFSection* pSection = CreateXFSection(); if (pStory) pStory->AddXFContent(pSection); - //pSection->Add(pPara); - m_pXFContainer = pSection; + m_xXFContainer.set(pSection); } if (m_bHasBullet && m_pSilverBullet) { - rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_pXFContainer); + rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_xXFContainer.get()); if (xListItem) { xListItem->Add(pPara); } } - else if (m_pXFContainer) + else if (m_xXFContainer) { LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr(); if (pBulletStyleMgr) @@ -292,14 +289,14 @@ void LwpPara::XFConvert(XFContentContainer* pCont) pBulletStyleMgr->SetCurrentSilverBullet(LwpObjectID()); pBulletStyleMgr->SetContinueFlag(false); } - m_pXFContainer->Add(pPara); + m_xXFContainer->Add(pPara); } m_Fribs.SetXFPara(pPara); m_Fribs.XFConvert(); - if (m_pBreaks && m_pXFContainer) - AddBreakAfter(m_pXFContainer); + if (m_pBreaks && m_xXFContainer) + AddBreakAfter(m_xXFContainer.get()); } void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle) diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx index 2b662ea75204..c18b9dee9d03 100644 --- a/lotuswordpro/source/filter/lwppara.hxx +++ b/lotuswordpro/source/filter/lwppara.hxx @@ -231,7 +231,7 @@ protected: LwpDropcapLayout* m_pDropcapLayout; double m_BelowSpacing; - XFContentContainer* m_pXFContainer; //Current container for VO_PARA + rtl::Reference<XFContentContainer> m_xXFContainer; //Current container for VO_PARA enum { @@ -309,7 +309,7 @@ inline LwpFribPtr& LwpPara::GetFribs() } inline XFContentContainer* LwpPara::GetXFContainer() { - return m_pXFContainer; + return m_xXFContainer.get(); } inline const OUString& LwpPara::GetBulletStyleName() const { @@ -317,13 +317,13 @@ inline const OUString& LwpPara::GetBulletStyleName() const } inline void LwpPara::AddXFContent(XFContent* pCont) { - if (!m_pXFContainer) + if (!m_xXFContainer) throw std::runtime_error("paragraph lacks container"); - m_pXFContainer->Add(pCont); + m_xXFContainer->Add(pCont); } inline void LwpPara::SetXFContainer(XFContentContainer* pCont) { - m_pXFContainer = pCont; + m_xXFContainer.set(pCont); } inline LwpIndentOverride* LwpPara::GetIndent() { |